From 66054d86f4485163884e5c7193ba88d69be86c11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Sat, 16 Sep 2023 16:18:57 +0200 Subject: [PATCH] Fix: Fetch custom fixers from Config\RuleSet --- infection.json | 2 +- psalm-baseline.xml | 3 +++ test/Unit/RuleSet/AbstractRuleSetTestCase.php | 9 ++++++--- test/Unit/RuleSet/Php53Test.php | 1 - test/Unit/RuleSet/Php54Test.php | 1 - test/Unit/RuleSet/Php55Test.php | 1 - test/Unit/RuleSet/Php56Test.php | 1 - test/Unit/RuleSet/Php70Test.php | 1 - test/Unit/RuleSet/Php71Test.php | 1 - test/Unit/RuleSet/Php72Test.php | 1 - test/Unit/RuleSet/Php73Test.php | 1 - test/Unit/RuleSet/Php74Test.php | 1 - test/Unit/RuleSet/Php80Test.php | 1 - test/Unit/RuleSet/Php81Test.php | 1 - test/Unit/RuleSet/Php82Test.php | 1 - 15 files changed, 10 insertions(+), 16 deletions(-) diff --git a/infection.json b/infection.json index c39a5772..ac634aed 100644 --- a/infection.json +++ b/infection.json @@ -4,7 +4,7 @@ "text": ".build/infection/infection-log.txt" }, "minCoveredMsi": 99, - "minMsi": 95, + "minMsi": 99, "phpUnit": { "configDir": "test\/Unit" }, diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 779cb51b..e1092275 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -152,6 +152,9 @@ new FixerFactory() registerBuiltInFixers + + customFixers()]]> + provideValidHeader diff --git a/test/Unit/RuleSet/AbstractRuleSetTestCase.php b/test/Unit/RuleSet/AbstractRuleSetTestCase.php index 9a6bbf89..fcb4005d 100644 --- a/test/Unit/RuleSet/AbstractRuleSetTestCase.php +++ b/test/Unit/RuleSet/AbstractRuleSetTestCase.php @@ -13,7 +13,6 @@ namespace Ergebnis\PhpCsFixer\Config\Test\Unit\RuleSet; -use Ergebnis\PhpCsFixer\Config\Factory; use Ergebnis\PhpCsFixer\Config\Name; use Ergebnis\PhpCsFixer\Config\PhpVersion; use Ergebnis\PhpCsFixer\Config\RuleSet; @@ -382,9 +381,13 @@ final protected static function fixersThatAreRegistered(): array $fixerFactory->registerBuiltInFixers(); + $fixersThatAreBuiltIn = $fixerFactory->getFixers(); + $fixersThatShouldBeRegistered = \iterator_to_array(self::createRuleSet()->customFixers()); + + /** @var array $fixers */ $fixers = \array_merge( - $fixerFactory->getFixers(), - Factory::fromRuleSet(self::createRuleSet())->getCustomFixers(), + $fixersThatAreBuiltIn, + $fixersThatShouldBeRegistered, ); $fixersThatAreRegistered = \array_combine( diff --git a/test/Unit/RuleSet/Php53Test.php b/test/Unit/RuleSet/Php53Test.php index a8ccab5e..743abfc6 100644 --- a/test/Unit/RuleSet/Php53Test.php +++ b/test/Unit/RuleSet/Php53Test.php @@ -21,7 +21,6 @@ #[Framework\Attributes\CoversClass(RuleSet\AbstractRuleSet::class)] #[Framework\Attributes\CoversClass(RuleSet\Php53::class)] -#[Framework\Attributes\RequiresPhp('>=5.3')] #[Framework\Attributes\UsesClass(Factory::class)] #[Framework\Attributes\UsesClass(Name::class)] #[Framework\Attributes\UsesClass(PhpVersion::class)] diff --git a/test/Unit/RuleSet/Php54Test.php b/test/Unit/RuleSet/Php54Test.php index 3d1026a9..84d70145 100644 --- a/test/Unit/RuleSet/Php54Test.php +++ b/test/Unit/RuleSet/Php54Test.php @@ -21,7 +21,6 @@ #[Framework\Attributes\CoversClass(RuleSet\AbstractRuleSet::class)] #[Framework\Attributes\CoversClass(RuleSet\Php54::class)] -#[Framework\Attributes\RequiresPhp('>=5.4')] #[Framework\Attributes\UsesClass(Factory::class)] #[Framework\Attributes\UsesClass(Name::class)] #[Framework\Attributes\UsesClass(PhpVersion::class)] diff --git a/test/Unit/RuleSet/Php55Test.php b/test/Unit/RuleSet/Php55Test.php index bbef6991..0cff1643 100644 --- a/test/Unit/RuleSet/Php55Test.php +++ b/test/Unit/RuleSet/Php55Test.php @@ -21,7 +21,6 @@ #[Framework\Attributes\CoversClass(RuleSet\AbstractRuleSet::class)] #[Framework\Attributes\CoversClass(RuleSet\Php55::class)] -#[Framework\Attributes\RequiresPhp('>=5.5')] #[Framework\Attributes\UsesClass(Factory::class)] #[Framework\Attributes\UsesClass(Name::class)] #[Framework\Attributes\UsesClass(PhpVersion::class)] diff --git a/test/Unit/RuleSet/Php56Test.php b/test/Unit/RuleSet/Php56Test.php index 58abce48..543abf4c 100644 --- a/test/Unit/RuleSet/Php56Test.php +++ b/test/Unit/RuleSet/Php56Test.php @@ -21,7 +21,6 @@ #[Framework\Attributes\CoversClass(RuleSet\AbstractRuleSet::class)] #[Framework\Attributes\CoversClass(RuleSet\Php56::class)] -#[Framework\Attributes\RequiresPhp('>=5.6')] #[Framework\Attributes\UsesClass(Factory::class)] #[Framework\Attributes\UsesClass(Name::class)] #[Framework\Attributes\UsesClass(PhpVersion::class)] diff --git a/test/Unit/RuleSet/Php70Test.php b/test/Unit/RuleSet/Php70Test.php index e8dfd53c..1eb0d3fc 100644 --- a/test/Unit/RuleSet/Php70Test.php +++ b/test/Unit/RuleSet/Php70Test.php @@ -21,7 +21,6 @@ #[Framework\Attributes\CoversClass(RuleSet\AbstractRuleSet::class)] #[Framework\Attributes\CoversClass(RuleSet\Php70::class)] -#[Framework\Attributes\RequiresPhp('>=7.0')] #[Framework\Attributes\UsesClass(Factory::class)] #[Framework\Attributes\UsesClass(Name::class)] #[Framework\Attributes\UsesClass(PhpVersion::class)] diff --git a/test/Unit/RuleSet/Php71Test.php b/test/Unit/RuleSet/Php71Test.php index 30b7ff8f..a9a9821a 100644 --- a/test/Unit/RuleSet/Php71Test.php +++ b/test/Unit/RuleSet/Php71Test.php @@ -21,7 +21,6 @@ #[Framework\Attributes\CoversClass(RuleSet\AbstractRuleSet::class)] #[Framework\Attributes\CoversClass(RuleSet\Php71::class)] -#[Framework\Attributes\RequiresPhp('>=7.1')] #[Framework\Attributes\UsesClass(Factory::class)] #[Framework\Attributes\UsesClass(Name::class)] #[Framework\Attributes\UsesClass(PhpVersion::class)] diff --git a/test/Unit/RuleSet/Php72Test.php b/test/Unit/RuleSet/Php72Test.php index a1c60def..3ff62d8f 100644 --- a/test/Unit/RuleSet/Php72Test.php +++ b/test/Unit/RuleSet/Php72Test.php @@ -21,7 +21,6 @@ #[Framework\Attributes\CoversClass(RuleSet\AbstractRuleSet::class)] #[Framework\Attributes\CoversClass(RuleSet\Php72::class)] -#[Framework\Attributes\RequiresPhp('>=7.2')] #[Framework\Attributes\UsesClass(Factory::class)] #[Framework\Attributes\UsesClass(Name::class)] #[Framework\Attributes\UsesClass(PhpVersion::class)] diff --git a/test/Unit/RuleSet/Php73Test.php b/test/Unit/RuleSet/Php73Test.php index 6baa8dfa..6e0708de 100644 --- a/test/Unit/RuleSet/Php73Test.php +++ b/test/Unit/RuleSet/Php73Test.php @@ -21,7 +21,6 @@ #[Framework\Attributes\CoversClass(RuleSet\AbstractRuleSet::class)] #[Framework\Attributes\CoversClass(RuleSet\Php73::class)] -#[Framework\Attributes\RequiresPhp('>=7.3')] #[Framework\Attributes\UsesClass(Factory::class)] #[Framework\Attributes\UsesClass(Name::class)] #[Framework\Attributes\UsesClass(PhpVersion::class)] diff --git a/test/Unit/RuleSet/Php74Test.php b/test/Unit/RuleSet/Php74Test.php index 8e60596f..a3d51d3b 100644 --- a/test/Unit/RuleSet/Php74Test.php +++ b/test/Unit/RuleSet/Php74Test.php @@ -21,7 +21,6 @@ #[Framework\Attributes\CoversClass(RuleSet\AbstractRuleSet::class)] #[Framework\Attributes\CoversClass(RuleSet\Php74::class)] -#[Framework\Attributes\RequiresPhp('>=7.4')] #[Framework\Attributes\UsesClass(Factory::class)] #[Framework\Attributes\UsesClass(Name::class)] #[Framework\Attributes\UsesClass(PhpVersion::class)] diff --git a/test/Unit/RuleSet/Php80Test.php b/test/Unit/RuleSet/Php80Test.php index 767c54a2..ea8b4108 100644 --- a/test/Unit/RuleSet/Php80Test.php +++ b/test/Unit/RuleSet/Php80Test.php @@ -21,7 +21,6 @@ #[Framework\Attributes\CoversClass(RuleSet\AbstractRuleSet::class)] #[Framework\Attributes\CoversClass(RuleSet\Php80::class)] -#[Framework\Attributes\RequiresPhp('>=8.0')] #[Framework\Attributes\UsesClass(Factory::class)] #[Framework\Attributes\UsesClass(Name::class)] #[Framework\Attributes\UsesClass(PhpVersion::class)] diff --git a/test/Unit/RuleSet/Php81Test.php b/test/Unit/RuleSet/Php81Test.php index d3e3bacb..ecd30c62 100644 --- a/test/Unit/RuleSet/Php81Test.php +++ b/test/Unit/RuleSet/Php81Test.php @@ -21,7 +21,6 @@ #[Framework\Attributes\CoversClass(RuleSet\AbstractRuleSet::class)] #[Framework\Attributes\CoversClass(RuleSet\Php81::class)] -#[Framework\Attributes\RequiresPhp('>=8.1')] #[Framework\Attributes\UsesClass(Factory::class)] #[Framework\Attributes\UsesClass(Name::class)] #[Framework\Attributes\UsesClass(PhpVersion::class)] diff --git a/test/Unit/RuleSet/Php82Test.php b/test/Unit/RuleSet/Php82Test.php index 1b7c56c0..6732ae32 100644 --- a/test/Unit/RuleSet/Php82Test.php +++ b/test/Unit/RuleSet/Php82Test.php @@ -21,7 +21,6 @@ #[Framework\Attributes\CoversClass(RuleSet\AbstractRuleSet::class)] #[Framework\Attributes\CoversClass(RuleSet\Php82::class)] -#[Framework\Attributes\RequiresPhp('>=8.2')] #[Framework\Attributes\UsesClass(Factory::class)] #[Framework\Attributes\UsesClass(Name::class)] #[Framework\Attributes\UsesClass(PhpVersion::class)]