From 556c3717b849808ec64c7fd984ed5da0fe2900de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Wer=C5=82os?= Date: Sat, 20 Jun 2020 18:24:06 +0200 Subject: [PATCH] PhpdocTrimConsecutiveBlankLineSeparationFixer - must run after AlignMultilineCommentFixer --- .../Phpdoc/AlignMultilineCommentFixer.php | 1 + src/Fixer/Phpdoc/PhpdocAlignFixer.php | 2 +- ...rimConsecutiveBlankLineSeparationFixer.php | 4 ++-- tests/AutoReview/FixerFactoryTest.php | 1 + ...rim_consecutive_blank_line_separation.test | 20 +++++++++++++++++++ 5 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 tests/Fixtures/Integration/priority/align_multiline_comment,phpdoc_trim_consecutive_blank_line_separation.test diff --git a/src/Fixer/Phpdoc/AlignMultilineCommentFixer.php b/src/Fixer/Phpdoc/AlignMultilineCommentFixer.php index 3ac63a8d5a4..8ef7f0b0516 100644 --- a/src/Fixer/Phpdoc/AlignMultilineCommentFixer.php +++ b/src/Fixer/Phpdoc/AlignMultilineCommentFixer.php @@ -86,6 +86,7 @@ public function getDefinition() /** * {@inheritdoc} * + * Must run before PhpdocTrimConsecutiveBlankLineSeparationFixer. * Must run after ArrayIndentationFixer. */ public function getPriority() diff --git a/src/Fixer/Phpdoc/PhpdocAlignFixer.php b/src/Fixer/Phpdoc/PhpdocAlignFixer.php index e9fef55cc34..303b933ec87 100644 --- a/src/Fixer/Phpdoc/PhpdocAlignFixer.php +++ b/src/Fixer/Phpdoc/PhpdocAlignFixer.php @@ -155,7 +155,7 @@ public function getPriority() * annotations are of the correct type, and are grouped correctly * before running this fixer. */ - return -21; + return -42; } /** diff --git a/src/Fixer/Phpdoc/PhpdocTrimConsecutiveBlankLineSeparationFixer.php b/src/Fixer/Phpdoc/PhpdocTrimConsecutiveBlankLineSeparationFixer.php index 1c633a82698..edf17593c06 100644 --- a/src/Fixer/Phpdoc/PhpdocTrimConsecutiveBlankLineSeparationFixer.php +++ b/src/Fixer/Phpdoc/PhpdocTrimConsecutiveBlankLineSeparationFixer.php @@ -63,11 +63,11 @@ function fnc($foo) {} * {@inheritdoc} * * Must run before PhpdocAlignFixer. - * Must run after CommentToPhpdocFixer, PhpdocIndentFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer. + * Must run after AlignMultilineCommentFixer, CommentToPhpdocFixer, PhpdocIndentFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer. */ public function getPriority() { - return 0; + return -41; } /** diff --git a/tests/AutoReview/FixerFactoryTest.php b/tests/AutoReview/FixerFactoryTest.php index 894d19729df..130ac3ada0e 100644 --- a/tests/AutoReview/FixerFactoryTest.php +++ b/tests/AutoReview/FixerFactoryTest.php @@ -61,6 +61,7 @@ public function provideFixersPriorityCases() } return [ + [$fixers['align_multiline_comment'], $fixers['phpdoc_trim_consecutive_blank_line_separation']], [$fixers['array_indentation'], $fixers['align_multiline_comment']], [$fixers['array_indentation'], $fixers['binary_operator_spaces']], [$fixers['array_syntax'], $fixers['binary_operator_spaces']], diff --git a/tests/Fixtures/Integration/priority/align_multiline_comment,phpdoc_trim_consecutive_blank_line_separation.test b/tests/Fixtures/Integration/priority/align_multiline_comment,phpdoc_trim_consecutive_blank_line_separation.test new file mode 100644 index 00000000000..57951f53cec --- /dev/null +++ b/tests/Fixtures/Integration/priority/align_multiline_comment,phpdoc_trim_consecutive_blank_line_separation.test @@ -0,0 +1,20 @@ +--TEST-- +Integration of fixers: align_multiline_comment,phpdoc_trim_consecutive_blank_line_separation. +--RULESET-- +{"align_multiline_comment": true, "phpdoc_trim_consecutive_blank_line_separation": true} +--EXPECT-- +