Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/code_analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ jobs:
name: 'Tests'
run: vendor/bin/phpunit

-
name: 'Composer Dependency Analysis'
run: vendor/bin/composer-dependency-analyser

-
name: 'Check Active Classes'
run: vendor/bin/class-leak check src --ansi
Expand Down
16 changes: 12 additions & 4 deletions composer-dependency-analyser.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,27 @@
use ShipMonk\ComposerDependencyAnalyser\Config\Configuration;
use ShipMonk\ComposerDependencyAnalyser\Config\ErrorType;

return (new Configuration())->addPathToScan(__DIR__ . '/src', false)
return (new Configuration())
->addPathToExclude(__DIR__ . '/tests/Rules/Rector/NoInstanceOfStaticReflectionRule/Fixture')
->addPathToExclude(__DIR__ . '/tests/Rules/Enum/RequireUniqueEnumConstantRule/Fixture')
->addPathToExclude(__DIR__ . '/tests/Rules/ForbiddenExtendOfNonAbstractClassRule/Fixture')
->addPathToExclude(__DIR__ . '/tests/Rules/PHPUnit/NoTestMocksRule/Fixture')

// optional classes
->ignoreUnknownClasses(['Symfony\Component\ExpressionLanguage\Expression'])

// already in phpstan/phpstan
->ignoreErrorsOnPackage('nikic/php-parser', [ErrorType::DEV_DEPENDENCY_IN_PROD])
->ignoreErrorsOnPackage('symfony/routing', [ErrorType::SHADOW_DEPENDENCY])
->ignoreErrorsOnPackage('symfony/var-dumper', [ErrorType::SHADOW_DEPENDENCY])
->ignoreErrorsOnPackage('symfony/service-contracts', [ErrorType::SHADOW_DEPENDENCY])
->ignoreErrorsOnPackage('symfony/http-kernel', [ErrorType::SHADOW_DEPENDENCY])
->ignoreErrorsOnPackage('symfony/event-dispatcher', [ErrorType::SHADOW_DEPENDENCY])
->ignoreErrorsOnPackage('symfony/deprecation-contracts', [ErrorType::SHADOW_DEPENDENCY])
->ignoreErrorsOnPackage('symfony/dependency-injection', [ErrorType::SHADOW_DEPENDENCY])
->ignoreErrorsOnPackage('symfony/config', [ErrorType::SHADOW_DEPENDENCY])

// rule that runs on Rector rule only
->ignoreErrorsOnPackage('rector/rector', [ErrorType::DEV_DEPENDENCY_IN_PROD])

->ignoreErrorsOnExtension('ext-ctype', [ErrorType::SHADOW_DEPENDENCY])
->ignoreErrorsOnExtension('ext-simplexml', [ErrorType::SHADOW_DEPENDENCY]);

// ->ignoreErrorsOnPath('/Fixture/', [\ShipMonk\ComposerDependencyAnalyser\Config\ErrorType::UNKNOWN_CLASS]);
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
},
"classmap": [
"stubs"
],
"files": [
"vendor/symfony/dependency-injection/Loader/Configurator/ContainerConfigurator.php"
]
},
"config": {
Expand Down
4 changes: 2 additions & 2 deletions src/Rules/PHPUnit/NoMockObjectAndRealObjectPropertyRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use PHPStan\Rules\Rule;
use PHPStan\Rules\RuleError;
use PHPStan\Rules\RuleErrorBuilder;
use PHPUnit\Framework\MockObject\MockObject;
use Symplify\PHPStanRules\Enum\ClassName;
use Symplify\PHPStanRules\Enum\RuleIdentifier\PHPUnitRuleIdentifier;

/**
Expand Down Expand Up @@ -46,7 +46,7 @@ public function processNode(Node $node, Scope $scope): array
continue;
}

if ($type->toString() !== MockObject::class) {
if ($type->toString() !== ClassName::MOCK_OBJECT_CLASS) {
continue;
}

Expand Down
8 changes: 8 additions & 0 deletions stubs/Doctrine/ODM/MongoDB/Event/OnFlushEventArgs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace Doctrine\ODM\MongoDB\Event;

class OnFlushEventArgs
{

}
10 changes: 10 additions & 0 deletions stubs/Doctrine/ORM/EntityManager.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace Doctrine\ORM;

class EntityManager implements EntityManagerInterface
{
public function getRepository(string $class): object
{
}
}
7 changes: 7 additions & 0 deletions stubs/Symfony/Component/Form/Event/PostSubmitEvent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Symfony\Component\Form\Event;

class PostSubmitEvent
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Symfony\Component\Security\Http\Firewall;

abstract class AbstractListener
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace Symfony\Component\Security\Http\Firewall;

class UsernamePasswordFormAuthenticationListener
{

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Symplify\PHPStanRules\Tests\Rules\Symfony\NoListenerWithoutContractRule\Fixture;

final class SkipAnotherSecurityListener extends
\Symfony\Component\Security\Http\Firewall\UsernamePasswordFormAuthenticationListener
{
use Symfony\Component\Security\Http\Firewall\UsernamePasswordFormAuthenticationListener;

final class SkipAnotherSecurityListener extends UsernamePasswordFormAuthenticationListener
{
}