diff --git a/README.md b/README.md index a3dc44cb..ef13ccad 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![Latest stable version](https://img.shields.io/packagist/v/kubawerlos/php-cs-fixer-custom-fixers.svg?label=current%20version)](https://packagist.org/packages/kubawerlos/php-cs-fixer-custom-fixers) [![PHP version](https://img.shields.io/packagist/php-v/kubawerlos/php-cs-fixer-custom-fixers.svg)](https://php.net) [![License](https://img.shields.io/github/license/kubawerlos/php-cs-fixer-custom-fixers.svg)](LICENSE) -![Tests](https://img.shields.io/badge/tests-3613-brightgreen.svg) +![Tests](https://img.shields.io/badge/tests-3607-brightgreen.svg) [![Downloads](https://img.shields.io/packagist/dt/kubawerlos/php-cs-fixer-custom-fixers.svg)](https://packagist.org/packages/kubawerlos/php-cs-fixer-custom-fixers) [![CI status](https://github.com/kubawerlos/php-cs-fixer-custom-fixers/actions/workflows/ci.yaml/badge.svg)](https://github.com/kubawerlos/php-cs-fixer-custom-fixers/actions/workflows/ci.yaml) diff --git a/src/Fixer/ConstructorEmptyBracesFixer.php b/src/Fixer/ConstructorEmptyBracesFixer.php index 323025dd..2bf7ba8d 100644 --- a/src/Fixer/ConstructorEmptyBracesFixer.php +++ b/src/Fixer/ConstructorEmptyBracesFixer.php @@ -41,7 +41,7 @@ public function __construct( } /** - * Must run after BracesFixer, CurlyBracesPositionFixer, PromotedConstructorPropertyFixer. + * Must run after BracesPositionFixer, PromotedConstructorPropertyFixer. */ public function getPriority(): int { diff --git a/src/Fixer/MultilinePromotedPropertiesFixer.php b/src/Fixer/MultilinePromotedPropertiesFixer.php index 527d3170..f6c75a1a 100644 --- a/src/Fixer/MultilinePromotedPropertiesFixer.php +++ b/src/Fixer/MultilinePromotedPropertiesFixer.php @@ -88,12 +88,12 @@ public function setWhitespacesConfig(WhitespacesFixerConfig $config): void } /** - * Must run before BracesFixer. + * Must run before BracesPositionFixer. * Must run after PromotedConstructorPropertyFixer. */ public function getPriority(): int { - return 36; + return 0; } public function isCandidate(Tokens $tokens): bool diff --git a/src/Fixer/NoDoctrineMigrationsGeneratedCommentFixer.php b/src/Fixer/NoDoctrineMigrationsGeneratedCommentFixer.php index 9e3165b1..bb54fe1d 100644 --- a/src/Fixer/NoDoctrineMigrationsGeneratedCommentFixer.php +++ b/src/Fixer/NoDoctrineMigrationsGeneratedCommentFixer.php @@ -48,11 +48,11 @@ public function down(Schema $schema) } /** - * Must run before BracesFixer. + * Must run before NoExtraBlankLinesFixer. */ public function getPriority(): int { - return 36; + return 0; } public function isCandidate(Tokens $tokens): bool diff --git a/src/Fixer/PromotedConstructorPropertyFixer.php b/src/Fixer/PromotedConstructorPropertyFixer.php index 1b3ef9f7..4c2bc465 100644 --- a/src/Fixer/PromotedConstructorPropertyFixer.php +++ b/src/Fixer/PromotedConstructorPropertyFixer.php @@ -84,7 +84,7 @@ public function configure(array $configuration): void } /** - * Must run before BracesFixer, ClassAttributesSeparationFixer, ConstructorEmptyBracesFixer, MultilinePromotedPropertiesFixer, NoExtraBlankLinesFixer, ReadonlyPromotedPropertiesFixer. + * Must run before ClassAttributesSeparationFixer, ConstructorEmptyBracesFixer, MultilinePromotedPropertiesFixer, NoExtraBlankLinesFixer, ReadonlyPromotedPropertiesFixer. */ public function getPriority(): int { diff --git a/tests/PriorityTest.php b/tests/PriorityTest.php index aba7d7de..322bb6bb 100644 --- a/tests/PriorityTest.php +++ b/tests/PriorityTest.php @@ -11,6 +11,8 @@ namespace Tests; +use PhpCsFixer\AbstractFixer; +use PhpCsFixer\Fixer\DeprecatedFixerInterface; use PhpCsFixer\Fixer\FixerInterface; use PhpCsFixer\Fixer\WhitespacesAwareFixerInterface; use PhpCsFixer\FixerFactory; @@ -45,6 +47,13 @@ public function testPriorities(FixerInterface $firstFixer, FixerInterface $secon */ public function testInOrder(FixerInterface $firstFixer, FixerInterface $secondFixer, string $expected, string $input): void { + if ($firstFixer instanceof AbstractFixer) { + self::assertNotInstanceOf(DeprecatedFixerInterface::class, $firstFixer); + } + if ($secondFixer instanceof AbstractFixer) { + self::assertNotInstanceOf(DeprecatedFixerInterface::class, $secondFixer); + } + Tokens::clearCache(); $tokens = Tokens::fromCode($input); diff --git a/tests/priority_fixtures/Custom_multiline_promoted_properties,braces.test b/tests/priority_fixtures/Custom_multiline_promoted_properties,braces_position.test similarity index 91% rename from tests/priority_fixtures/Custom_multiline_promoted_properties,braces.test rename to tests/priority_fixtures/Custom_multiline_promoted_properties,braces_position.test index d69ea32c..b0427eae 100644 --- a/tests/priority_fixtures/Custom_multiline_promoted_properties,braces.test +++ b/tests/priority_fixtures/Custom_multiline_promoted_properties,braces_position.test @@ -1,5 +1,5 @@ --CONFIGURATION-- -{ "PhpCsFixerCustomFixers/multiline_promoted_properties": true, "braces": true } +{ "PhpCsFixerCustomFixers/multiline_promoted_properties": true, "braces_position": true } --EXPECTED-- x = $x; - } -} diff --git a/tests/priority_fixtures/braces,Custom_constructor_empty_braces.test b/tests/priority_fixtures/braces_position,Custom_constructor_empty_braces.test similarity index 64% rename from tests/priority_fixtures/braces,Custom_constructor_empty_braces.test rename to tests/priority_fixtures/braces_position,Custom_constructor_empty_braces.test index 0900b342..cfcf1157 100644 --- a/tests/priority_fixtures/braces,Custom_constructor_empty_braces.test +++ b/tests/priority_fixtures/braces_position,Custom_constructor_empty_braces.test @@ -1,5 +1,5 @@ --CONFIGURATION-- -{ "braces": true, "PhpCsFixerCustomFixers/constructor_empty_braces": true } +{ "braces_position": true, "PhpCsFixerCustomFixers/constructor_empty_braces": true } --EXPECTED--