From 9167592a7eb31f399f61dda24f2a660f3272cf8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Wer=C5=82os?= Date: Fri, 19 Jan 2024 16:17:54 +0100 Subject: [PATCH] chore: `FullyQualifiedStrictTypesFixer` must run before `OrderedInterfacesFixer` (#7762) --- .../ClassNotation/OrderedInterfacesFixer.php | 10 ++++++++ .../Import/FullyQualifiedStrictTypesFixer.php | 2 +- tests/AutoReview/FixerFactoryTest.php | 1 + ...ified_strict_types,ordered_interfaces.test | 23 +++++++++++++++++++ 4 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 tests/Fixtures/Integration/priority/fully_qualified_strict_types,ordered_interfaces.test diff --git a/src/Fixer/ClassNotation/OrderedInterfacesFixer.php b/src/Fixer/ClassNotation/OrderedInterfacesFixer.php index a768190286c..985c9e83b70 100644 --- a/src/Fixer/ClassNotation/OrderedInterfacesFixer.php +++ b/src/Fixer/ClassNotation/OrderedInterfacesFixer.php @@ -108,6 +108,16 @@ public function getDefinition(): FixerDefinitionInterface ); } + /** + * {@inheritdoc} + * + * Must run after FullyQualifiedStrictTypesFixer. + */ + public function getPriority(): int + { + return 0; + } + public function isCandidate(Tokens $tokens): bool { return $tokens->isTokenKindFound(T_IMPLEMENTS) diff --git a/src/Fixer/Import/FullyQualifiedStrictTypesFixer.php b/src/Fixer/Import/FullyQualifiedStrictTypesFixer.php index 0b993432b95..f70c517448d 100644 --- a/src/Fixer/Import/FullyQualifiedStrictTypesFixer.php +++ b/src/Fixer/Import/FullyQualifiedStrictTypesFixer.php @@ -174,7 +174,7 @@ public function foo(): \Other\FunctionReturnType /** * {@inheritdoc} * - * Must run before NoSuperfluousPhpdocTagsFixer, OrderedImportsFixer, StatementIndentationFixer. + * Must run before NoSuperfluousPhpdocTagsFixer, OrderedImportsFixer, OrderedInterfacesFixer, StatementIndentationFixer. * Must run after PhpdocToReturnTypeFixer. */ public function getPriority(): int diff --git a/tests/AutoReview/FixerFactoryTest.php b/tests/AutoReview/FixerFactoryTest.php index f7ac929e750..8d42deb6557 100644 --- a/tests/AutoReview/FixerFactoryTest.php +++ b/tests/AutoReview/FixerFactoryTest.php @@ -449,6 +449,7 @@ private static function getFixersPriorityGraph(): array 'fully_qualified_strict_types' => [ 'no_superfluous_phpdoc_tags', 'ordered_imports', + 'ordered_interfaces', 'statement_indentation', ], 'function_declaration' => [ diff --git a/tests/Fixtures/Integration/priority/fully_qualified_strict_types,ordered_interfaces.test b/tests/Fixtures/Integration/priority/fully_qualified_strict_types,ordered_interfaces.test new file mode 100644 index 00000000000..76aee82d360 --- /dev/null +++ b/tests/Fixtures/Integration/priority/fully_qualified_strict_types,ordered_interfaces.test @@ -0,0 +1,23 @@ +--TEST-- +Integration of fixers: fully_qualified_strict_types,ordered_interfaces. +--RULESET-- +{"fully_qualified_strict_types": true, "ordered_interfaces": true} +--EXPECT-- +