From 2821dd230330c7835bbb2335617d14c52f1cab35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Wer=C5=82os?= Date: Thu, 4 Jun 2020 18:42:45 +0200 Subject: [PATCH] FinalInternalClassFixer - must run before ProtectedToPrivateFixer --- .../ClassNotation/FinalInternalClassFixer.php | 3 ++- .../ClassNotation/ProtectedToPrivateFixer.php | 1 + .../PhpUnit/PhpUnitInternalClassFixer.php | 2 +- tests/AutoReview/FixerFactoryTest.php | 1 + ...l_internal_class,protected_to_private.test | 25 +++++++++++++++++++ 5 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 tests/Fixtures/Integration/priority/final_internal_class,protected_to_private.test diff --git a/src/Fixer/ClassNotation/FinalInternalClassFixer.php b/src/Fixer/ClassNotation/FinalInternalClassFixer.php index f2f9c8ef5e9..6ec7fbcdbc9 100644 --- a/src/Fixer/ClassNotation/FinalInternalClassFixer.php +++ b/src/Fixer/ClassNotation/FinalInternalClassFixer.php @@ -72,11 +72,12 @@ public function getDefinition() /** * {@inheritdoc} * + * Must run before ProtectedToPrivateFixer. * Must run after PhpUnitInternalClassFixer. */ public function getPriority() { - return 0; + return 67; } /** diff --git a/src/Fixer/ClassNotation/ProtectedToPrivateFixer.php b/src/Fixer/ClassNotation/ProtectedToPrivateFixer.php index 2b6760dd131..6c6c502b7ff 100644 --- a/src/Fixer/ClassNotation/ProtectedToPrivateFixer.php +++ b/src/Fixer/ClassNotation/ProtectedToPrivateFixer.php @@ -53,6 +53,7 @@ protected function test() * {@inheritdoc} * * Must run before OrderedClassElementsFixer. + * Must run after FinalInternalClassFixer. */ public function getPriority() { diff --git a/src/Fixer/PhpUnit/PhpUnitInternalClassFixer.php b/src/Fixer/PhpUnit/PhpUnitInternalClassFixer.php index 013cec41043..bb0bf276b0a 100644 --- a/src/Fixer/PhpUnit/PhpUnitInternalClassFixer.php +++ b/src/Fixer/PhpUnit/PhpUnitInternalClassFixer.php @@ -49,7 +49,7 @@ public function getDefinition() */ public function getPriority() { - return 1; + return 68; } /** diff --git a/tests/AutoReview/FixerFactoryTest.php b/tests/AutoReview/FixerFactoryTest.php index 315ba684b6c..894d19729df 100644 --- a/tests/AutoReview/FixerFactoryTest.php +++ b/tests/AutoReview/FixerFactoryTest.php @@ -94,6 +94,7 @@ public function provideFixersPriorityCases() [$fixers['escape_implicit_backslashes'], $fixers['heredoc_to_nowdoc']], [$fixers['escape_implicit_backslashes'], $fixers['single_quote']], [$fixers['explicit_string_variable'], $fixers['simple_to_complex_string_variable']], + [$fixers['final_internal_class'], $fixers['protected_to_private']], [$fixers['fully_qualified_strict_types'], $fixers['no_superfluous_phpdoc_tags']], [$fixers['function_to_constant'], $fixers['native_function_casing']], [$fixers['function_to_constant'], $fixers['no_extra_blank_lines']], diff --git a/tests/Fixtures/Integration/priority/final_internal_class,protected_to_private.test b/tests/Fixtures/Integration/priority/final_internal_class,protected_to_private.test new file mode 100644 index 00000000000..d2c52160ad4 --- /dev/null +++ b/tests/Fixtures/Integration/priority/final_internal_class,protected_to_private.test @@ -0,0 +1,25 @@ +--TEST-- +Integration of fixers: final_internal_class,protected_to_private. +--RULESET-- +{"final_internal_class": true, "protected_to_private": true} +--EXPECT-- +