diff --git a/composer.json b/composer.json index d7c5246..c92921c 100755 --- a/composer.json +++ b/composer.json @@ -32,7 +32,7 @@ "phpstan/phpstan-nette": "^2.0", "phpstan/phpstan-phpunit": "^2.0", "phpstan/phpstan-strict-rules": "^2.0", - "rector/rector": "^2.3", + "rector/rector": "^2.5.9", "slevomat/coding-standard": "^8.15.0", "squizlabs/php_codesniffer": "^3.9.2", "symplify/easy-coding-standard": "^12.1.14", diff --git a/default-phpstan.neon b/default-phpstan.neon index 4b9fdd1..5e2b510 100644 --- a/default-phpstan.neon +++ b/default-phpstan.neon @@ -10,12 +10,8 @@ includes: services: # Handy services from Rector package - Rector\NodeNameResolver\NodeNameResolver - - Rector\Skipper\Matcher\FileInfoMatcher - Rector\CodingStyle\Naming\ClassNaming - Rector\NodeAnalyzer\CallAnalyzer - - Rector\Skipper\FileSystem\FnMatchPathNormalizer - - Rector\Skipper\Fnmatcher - - Rector\Skipper\RealpathMatcher parameters: level: max diff --git a/phpstan.neon b/phpstan.neon index 824d929..05928df 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -9,12 +9,8 @@ includes: services: # Handy services from Rector package - Rector\NodeNameResolver\NodeNameResolver - - Rector\Skipper\Matcher\FileInfoMatcher - Rector\CodingStyle\Naming\ClassNaming - Rector\NodeAnalyzer\CallAnalyzer - - Rector\Skipper\FileSystem\FnMatchPathNormalizer - - Rector\Skipper\Fnmatcher - - Rector\Skipper\RealpathMatcher - class: BrandEmbassyCodingStandard\PhpStan\Rules\Mockery\TestsExtendMockeryTestCaseRule\TestsExtendMockeryTestCaseRule diff --git a/src/BrandEmbassyCodingStandard/PhpStan/Rules/DisallowConstantsInTestsRule/DisallowConstantsInTestsRule.php b/src/BrandEmbassyCodingStandard/PhpStan/Rules/DisallowConstantsInTestsRule/DisallowConstantsInTestsRule.php index 87eed35..c30f05e 100644 --- a/src/BrandEmbassyCodingStandard/PhpStan/Rules/DisallowConstantsInTestsRule/DisallowConstantsInTestsRule.php +++ b/src/BrandEmbassyCodingStandard/PhpStan/Rules/DisallowConstantsInTestsRule/DisallowConstantsInTestsRule.php @@ -99,10 +99,10 @@ public function processNode(Node $node, Scope $scope): array return []; } - if ($this->fileInfoMatcher->doesFileInfoMatchPatterns( + if ($this->fileInfoMatcher->matchPattern( $constantClassReflection->getFileName() ?? '', $this->allowedPatterns, - )) { + ) !== null) { return []; } diff --git a/src/BrandEmbassyCodingStandard/PhpStan/Rules/DisallowConstantsInTestsRule/DisallowConstantsInTestsRuleTest.php b/src/BrandEmbassyCodingStandard/PhpStan/Rules/DisallowConstantsInTestsRule/DisallowConstantsInTestsRuleTest.php index 3331312..47b0918 100644 --- a/src/BrandEmbassyCodingStandard/PhpStan/Rules/DisallowConstantsInTestsRule/DisallowConstantsInTestsRuleTest.php +++ b/src/BrandEmbassyCodingStandard/PhpStan/Rules/DisallowConstantsInTestsRule/DisallowConstantsInTestsRuleTest.php @@ -5,10 +5,7 @@ use BrandEmbassyCodingStandard\PhpStan\Rules\DisallowConstantsInTestsRule\__fixtures__\AllowedConstant; use PHPStan\Rules\Rule; use PHPStan\Testing\RuleTestCase; -use Rector\Skipper\FileSystem\FnMatchPathNormalizer; -use Rector\Skipper\Fnmatcher; use Rector\Skipper\Matcher\FileInfoMatcher; -use Rector\Skipper\RealpathMatcher; /** * @extends RuleTestCase @@ -19,7 +16,7 @@ protected function getRule(): Rule { return new DisallowConstantsInTestsRule( $this->createReflectionProvider(), - new FileInfoMatcher(new FnMatchPathNormalizer(), new Fnmatcher(), new RealpathMatcher()), + new FileInfoMatcher(), ['*AllowedPattern.php'], [AllowedConstant::class], ); diff --git a/src/BrandEmbassyCodingStandard/Rector/DisallowConstantsInTestsRector/DisallowConstantsInTestsRector.php b/src/BrandEmbassyCodingStandard/Rector/DisallowConstantsInTestsRector/DisallowConstantsInTestsRector.php index c8b6064..79dbbd1 100644 --- a/src/BrandEmbassyCodingStandard/Rector/DisallowConstantsInTestsRector/DisallowConstantsInTestsRector.php +++ b/src/BrandEmbassyCodingStandard/Rector/DisallowConstantsInTestsRector/DisallowConstantsInTestsRector.php @@ -146,10 +146,10 @@ public function refactor(Node $node) return null; } - if ($this->fileInfoMatcher->doesFileInfoMatchPatterns( + if ($this->fileInfoMatcher->matchPattern( $constantClassReflection->getFileName() ?? '', $this->allowedPatterns, - )) { + ) !== null) { return null; }