diff --git a/src/Fixer/Comment/SingleLineCommentStyleFixer.php b/src/Fixer/Comment/SingleLineCommentStyleFixer.php index ed19fd4ff5e..f990772988b 100644 --- a/src/Fixer/Comment/SingleLineCommentStyleFixer.php +++ b/src/Fixer/Comment/SingleLineCommentStyleFixer.php @@ -98,6 +98,16 @@ public function getDefinition() ); } + /** + * {@inheritdoc} + * + * Must run after NoUselessReturnFixer. + */ + public function getPriority() + { + return -19; + } + /** * {@inheritdoc} */ diff --git a/src/Fixer/ReturnNotation/NoUselessReturnFixer.php b/src/Fixer/ReturnNotation/NoUselessReturnFixer.php index 0452f2bfb34..740a18d95dc 100644 --- a/src/Fixer/ReturnNotation/NoUselessReturnFixer.php +++ b/src/Fixer/ReturnNotation/NoUselessReturnFixer.php @@ -55,7 +55,7 @@ function example($b) { /** * {@inheritdoc} * - * Must run before BlankLineBeforeReturnFixer, BlankLineBeforeStatementFixer, NoExtraBlankLinesFixer, NoWhitespaceInBlankLineFixer. + * Must run before BlankLineBeforeReturnFixer, BlankLineBeforeStatementFixer, NoExtraBlankLinesFixer, NoWhitespaceInBlankLineFixer, SingleLineCommentStyleFixer. * Must run after NoEmptyStatementFixer, NoUnneededCurlyBracesFixer, NoUselessElseFixer, SimplifiedNullReturnFixer. */ public function getPriority() diff --git a/tests/AutoReview/FixerFactoryTest.php b/tests/AutoReview/FixerFactoryTest.php index 9e324df57d1..4fc168dde77 100644 --- a/tests/AutoReview/FixerFactoryTest.php +++ b/tests/AutoReview/FixerFactoryTest.php @@ -192,6 +192,7 @@ public function provideFixersPriorityCases() [$fixers['no_useless_return'], $fixers['blank_line_before_statement']], [$fixers['no_useless_return'], $fixers['no_extra_blank_lines']], [$fixers['no_useless_return'], $fixers['no_whitespace_in_blank_line']], + [$fixers['no_useless_return'], $fixers['single_line_comment_style']], [$fixers['no_useless_sprintf'], $fixers['method_argument_space']], [$fixers['no_useless_sprintf'], $fixers['native_function_casing']], [$fixers['no_useless_sprintf'], $fixers['no_empty_statement']], diff --git a/tests/Fixtures/Integration/priority/no_useless_return,single_line_comment_style.test b/tests/Fixtures/Integration/priority/no_useless_return,single_line_comment_style.test new file mode 100644 index 00000000000..5e953b97bb9 --- /dev/null +++ b/tests/Fixtures/Integration/priority/no_useless_return,single_line_comment_style.test @@ -0,0 +1,17 @@ +--TEST-- +Integration of fixers: no_useless_return,single_line_comment_style. +--RULESET-- +{ "no_useless_return": true, "single_line_comment_style": true } +--EXPECT-- +