From f27a841da28ca0dfdfc3fe8a17f2eac6e8026a74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Wer=C5=82os?= Date: Sun, 28 Jun 2020 21:05:44 +0200 Subject: [PATCH] VoidReturnFixer - must run after NoSuperfluousPhpdocTagsFixer --- src/Fixer/FunctionNotation/VoidReturnFixer.php | 4 ++-- src/Fixer/Phpdoc/NoEmptyPhpdocFixer.php | 2 +- .../Phpdoc/NoSuperfluousPhpdocTagsFixer.php | 2 +- src/Fixer/Phpdoc/PhpdocNoEmptyReturnFixer.php | 2 +- tests/AutoReview/FixerFactoryTest.php | 1 + ...no_superfluous_phpdoc_tags,void_return.test | 18 ++++++++++++++++++ 6 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 tests/Fixtures/Integration/priority/no_superfluous_phpdoc_tags,void_return.test diff --git a/src/Fixer/FunctionNotation/VoidReturnFixer.php b/src/Fixer/FunctionNotation/VoidReturnFixer.php index 7f6107e4a77..00eba40b5b4 100644 --- a/src/Fixer/FunctionNotation/VoidReturnFixer.php +++ b/src/Fixer/FunctionNotation/VoidReturnFixer.php @@ -50,11 +50,11 @@ public function getDefinition() * {@inheritdoc} * * Must run before PhpdocNoEmptyReturnFixer, ReturnTypeDeclarationFixer. - * Must run after SimplifiedNullReturnFixer. + * Must run after NoSuperfluousPhpdocTagsFixer, SimplifiedNullReturnFixer. */ public function getPriority() { - return 15; + return 5; } /** diff --git a/src/Fixer/Phpdoc/NoEmptyPhpdocFixer.php b/src/Fixer/Phpdoc/NoEmptyPhpdocFixer.php index 9545ff437f2..2e3feedd7e7 100644 --- a/src/Fixer/Phpdoc/NoEmptyPhpdocFixer.php +++ b/src/Fixer/Phpdoc/NoEmptyPhpdocFixer.php @@ -42,7 +42,7 @@ public function getDefinition() */ public function getPriority() { - return 5; + return 3; } /** diff --git a/src/Fixer/Phpdoc/NoSuperfluousPhpdocTagsFixer.php b/src/Fixer/Phpdoc/NoSuperfluousPhpdocTagsFixer.php index ef92cd53c53..83af2b98d69 100644 --- a/src/Fixer/Phpdoc/NoSuperfluousPhpdocTagsFixer.php +++ b/src/Fixer/Phpdoc/NoSuperfluousPhpdocTagsFixer.php @@ -82,7 +82,7 @@ class Foo { /** * {@inheritdoc} * - * Must run before NoEmptyPhpdocFixer, PhpdocAlignFixer. + * Must run before NoEmptyPhpdocFixer, PhpdocAlignFixer, VoidReturnFixer. * Must run after CommentToPhpdocFixer, FullyQualifiedStrictTypesFixer, PhpdocAddMissingParamAnnotationFixer, PhpdocIndentFixer, PhpdocReturnSelfReferenceFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocToReturnTypeFixer, PhpdocTypesFixer. */ public function getPriority() diff --git a/src/Fixer/Phpdoc/PhpdocNoEmptyReturnFixer.php b/src/Fixer/Phpdoc/PhpdocNoEmptyReturnFixer.php index 774f8ec8f3e..2e394e3c1f0 100644 --- a/src/Fixer/Phpdoc/PhpdocNoEmptyReturnFixer.php +++ b/src/Fixer/Phpdoc/PhpdocNoEmptyReturnFixer.php @@ -69,7 +69,7 @@ function foo() {} */ public function getPriority() { - return 10; + return 4; } /** diff --git a/tests/AutoReview/FixerFactoryTest.php b/tests/AutoReview/FixerFactoryTest.php index ca887efae5a..42140431ffd 100644 --- a/tests/AutoReview/FixerFactoryTest.php +++ b/tests/AutoReview/FixerFactoryTest.php @@ -152,6 +152,7 @@ public function provideFixersPriorityCases() [$fixers['no_spaces_after_function_name'], $fixers['function_to_constant']], [$fixers['no_spaces_inside_parenthesis'], $fixers['function_to_constant']], [$fixers['no_superfluous_phpdoc_tags'], $fixers['no_empty_phpdoc']], + [$fixers['no_superfluous_phpdoc_tags'], $fixers['void_return']], [$fixers['no_unneeded_control_parentheses'], $fixers['no_trailing_whitespace']], [$fixers['no_unneeded_curly_braces'], $fixers['no_useless_else']], [$fixers['no_unneeded_curly_braces'], $fixers['no_useless_return']], diff --git a/tests/Fixtures/Integration/priority/no_superfluous_phpdoc_tags,void_return.test b/tests/Fixtures/Integration/priority/no_superfluous_phpdoc_tags,void_return.test new file mode 100644 index 00000000000..c755a30586e --- /dev/null +++ b/tests/Fixtures/Integration/priority/no_superfluous_phpdoc_tags,void_return.test @@ -0,0 +1,18 @@ +--TEST-- +Integration of fixers: no_superfluous_phpdoc_tags,void_return. +--RULESET-- +{"no_superfluous_phpdoc_tags": true, "void_return": true} +--REQUIREMENTS-- +{"php": 70100} +--EXPECT-- +