From ca36da50c7453133bf4f2f9a0e481314e84f5372 Mon Sep 17 00:00:00 2001 From: Dariusz Ruminski Date: Wed, 17 Mar 2021 19:22:03 +0100 Subject: [PATCH 01/10] DX: test relation between function_declaration and method_argument_space --- .../FunctionNotation/FunctionDeclarationFixer.php | 10 ++++++++++ .../FunctionNotation/MethodArgumentSpaceFixer.php | 2 +- tests/AutoReview/FixerFactoryTest.php | 1 + ...unction_declaration,method_argument_space.test | 15 +++++++++++++++ 4 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 tests/Fixtures/Integration/priority/function_declaration,method_argument_space.test diff --git a/src/Fixer/FunctionNotation/FunctionDeclarationFixer.php b/src/Fixer/FunctionNotation/FunctionDeclarationFixer.php index 31c2b74e51b..1de171d947c 100644 --- a/src/Fixer/FunctionNotation/FunctionDeclarationFixer.php +++ b/src/Fixer/FunctionNotation/FunctionDeclarationFixer.php @@ -99,6 +99,16 @@ function foo ($bar, $baz) ); } + /** + * {@inheritdoc} + * + * Must run before MethodArgumentSpaceFixer. + */ + public function getPriority() + { + return 31; + } + /** * {@inheritdoc} */ diff --git a/src/Fixer/FunctionNotation/MethodArgumentSpaceFixer.php b/src/Fixer/FunctionNotation/MethodArgumentSpaceFixer.php index dc15f2ed5ae..7fc0202c7d8 100644 --- a/src/Fixer/FunctionNotation/MethodArgumentSpaceFixer.php +++ b/src/Fixer/FunctionNotation/MethodArgumentSpaceFixer.php @@ -129,7 +129,7 @@ public function configure(array $configuration = null) * {@inheritdoc} * * Must run before ArrayIndentationFixer. - * Must run after BracesFixer, CombineNestedDirnameFixer, ImplodeCallFixer, MethodChainingIndentationFixer, NoUselessSprintfFixer, PowToExponentiationFixer. + * Must run after BracesFixer, CombineNestedDirnameFixer, FunctionDeclarationFixer, ImplodeCallFixer, MethodChainingIndentationFixer, NoUselessSprintfFixer, PowToExponentiationFixer. */ public function getPriority() { diff --git a/tests/AutoReview/FixerFactoryTest.php b/tests/AutoReview/FixerFactoryTest.php index afcf7fa891a..dcc8d1645fd 100644 --- a/tests/AutoReview/FixerFactoryTest.php +++ b/tests/AutoReview/FixerFactoryTest.php @@ -102,6 +102,7 @@ public function provideFixersPriorityCases() [$fixers['final_internal_class'], $fixers['protected_to_private']], [$fixers['final_internal_class'], $fixers['self_static_accessor']], [$fixers['fully_qualified_strict_types'], $fixers['no_superfluous_phpdoc_tags']], + [$fixers['function_declaration'], $fixers['method_argument_space']], [$fixers['function_to_constant'], $fixers['native_function_casing']], [$fixers['function_to_constant'], $fixers['no_extra_blank_lines']], [$fixers['function_to_constant'], $fixers['no_singleline_whitespace_before_semicolons']], diff --git a/tests/Fixtures/Integration/priority/function_declaration,method_argument_space.test b/tests/Fixtures/Integration/priority/function_declaration,method_argument_space.test new file mode 100644 index 00000000000..11701c70524 --- /dev/null +++ b/tests/Fixtures/Integration/priority/function_declaration,method_argument_space.test @@ -0,0 +1,15 @@ +--TEST-- +Integration of fixers: function_declaration,method_argument_space. +--RULESET-- +{"function_declaration": true, "method_argument_space": true} +--REQUIREMENTS-- +{"php": 80000} +--EXPECT-- + Date: Wed, 17 Mar 2021 16:10:13 +0100 Subject: [PATCH 02/10] TypeAlternationTransformer - fix for typed static properties --- .../Transformer/TypeAlternationTransformer.php | 6 +++--- .../TypeAlternationTransformerTest.php | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/Tokenizer/Transformer/TypeAlternationTransformer.php b/src/Tokenizer/Transformer/TypeAlternationTransformer.php index 15eb0842ccf..07cd08879b7 100644 --- a/src/Tokenizer/Transformer/TypeAlternationTransformer.php +++ b/src/Tokenizer/Transformer/TypeAlternationTransformer.php @@ -74,9 +74,9 @@ public function process(Tokens $tokens, Token $token, $index) $prevToken = $tokens[$prevIndex]; if ($prevToken->isGivenKind([ - CT::T_TYPE_COLON, // `|` is part of a function return type union `foo(): A|B` - CT::T_TYPE_ALTERNATION, // `|` is part of a union (chain) `| X | Y` - T_VAR, T_PUBLIC, T_PROTECTED, T_PRIVATE, // `|` is part of class property `var X|Y $a;` + CT::T_TYPE_COLON, // `:` is part of a function return type `foo(): A` + CT::T_TYPE_ALTERNATION, // `|` is part of a union (chain) `X | Y` + T_STATIC, T_VAR, T_PUBLIC, T_PROTECTED, T_PRIVATE, // `var $a;`, `private $a` or `public static $a` ])) { $this->replaceToken($tokens, $index); diff --git a/tests/Tokenizer/Transformer/TypeAlternationTransformerTest.php b/tests/Tokenizer/Transformer/TypeAlternationTransformerTest.php index 7d35cb71f9c..c009ebd2612 100644 --- a/tests/Tokenizer/Transformer/TypeAlternationTransformerTest.php +++ b/tests/Tokenizer/Transformer/TypeAlternationTransformerTest.php @@ -211,5 +211,20 @@ class Number 73 => CT::T_TYPE_ALTERNATION, ], ]; + + yield 'typed static properties' => [ + ' CT::T_TYPE_ALTERNATION, + 27 => CT::T_TYPE_ALTERNATION, + 31 => CT::T_TYPE_ALTERNATION, + 35 => CT::T_TYPE_ALTERNATION, + ], + ]; } } From dcf5699e0807e98d56778b0351b06066af806cb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Wer=C5=82os?= Date: Wed, 17 Mar 2021 16:57:40 +0100 Subject: [PATCH 03/10] ClassAttributesSeparationFixer - fix for properties with type alternation --- .../ClassAttributesSeparationFixer.php | 2 +- .../TypeAlternationTransformer.php | 6 ++--- .../ClassAttributesSeparationFixerTest.php | 22 ++++++++++++++++++- .../TypeAlternationTransformerTest.php | 15 +++++++++++++ 4 files changed, 40 insertions(+), 5 deletions(-) diff --git a/src/Fixer/ClassNotation/ClassAttributesSeparationFixer.php b/src/Fixer/ClassNotation/ClassAttributesSeparationFixer.php index fe8c6f151a2..937a6b6005c 100644 --- a/src/Fixer/ClassNotation/ClassAttributesSeparationFixer.php +++ b/src/Fixer/ClassNotation/ClassAttributesSeparationFixer.php @@ -304,7 +304,7 @@ private function fixSpaceBelowClassMethod(Tokens $tokens, $classEndIndex, $eleme */ private function fixSpaceAboveClassElement(Tokens $tokens, $classStartIndex, $elementIndex, $spacing) { - static $methodAttr = [T_PRIVATE, T_PROTECTED, T_PUBLIC, T_ABSTRACT, T_FINAL, T_STATIC, T_STRING, T_NS_SEPARATOR, T_VAR, CT::T_NULLABLE_TYPE, CT::T_ARRAY_TYPEHINT]; + static $methodAttr = [T_PRIVATE, T_PROTECTED, T_PUBLIC, T_ABSTRACT, T_FINAL, T_STATIC, T_STRING, T_NS_SEPARATOR, T_VAR, CT::T_NULLABLE_TYPE, CT::T_ARRAY_TYPEHINT, CT::T_TYPE_ALTERNATION]; $nonWhiteAbove = null; diff --git a/src/Tokenizer/Transformer/TypeAlternationTransformer.php b/src/Tokenizer/Transformer/TypeAlternationTransformer.php index 15eb0842ccf..07cd08879b7 100644 --- a/src/Tokenizer/Transformer/TypeAlternationTransformer.php +++ b/src/Tokenizer/Transformer/TypeAlternationTransformer.php @@ -74,9 +74,9 @@ public function process(Tokens $tokens, Token $token, $index) $prevToken = $tokens[$prevIndex]; if ($prevToken->isGivenKind([ - CT::T_TYPE_COLON, // `|` is part of a function return type union `foo(): A|B` - CT::T_TYPE_ALTERNATION, // `|` is part of a union (chain) `| X | Y` - T_VAR, T_PUBLIC, T_PROTECTED, T_PRIVATE, // `|` is part of class property `var X|Y $a;` + CT::T_TYPE_COLON, // `:` is part of a function return type `foo(): A` + CT::T_TYPE_ALTERNATION, // `|` is part of a union (chain) `X | Y` + T_STATIC, T_VAR, T_PUBLIC, T_PROTECTED, T_PRIVATE, // `var $a;`, `private $a` or `public static $a` ])) { $this->replaceToken($tokens, $index); diff --git a/tests/Fixer/ClassNotation/ClassAttributesSeparationFixerTest.php b/tests/Fixer/ClassNotation/ClassAttributesSeparationFixerTest.php index 8f4f34e86e6..fc9e238ae47 100644 --- a/tests/Fixer/ClassNotation/ClassAttributesSeparationFixerTest.php +++ b/tests/Fixer/ClassNotation/ClassAttributesSeparationFixerTest.php @@ -1416,7 +1416,7 @@ class User3 }', ]; - yield [ + yield 'constructor property promotion' => [ ' [ + ' CT::T_TYPE_ALTERNATION, ], ]; + + yield 'typed static properties' => [ + ' CT::T_TYPE_ALTERNATION, + 27 => CT::T_TYPE_ALTERNATION, + 31 => CT::T_TYPE_ALTERNATION, + 35 => CT::T_TYPE_ALTERNATION, + ], + ]; } } From 701708e74d44f5a9e98aa02d1380b4d342f8f8ee Mon Sep 17 00:00:00 2001 From: Dave van der Brugge Date: Wed, 17 Mar 2021 21:23:07 +0100 Subject: [PATCH 04/10] Priority: AlignMultilineComment should run before every PhpdocFixer --- src/AbstractNoUselessElseFixer.php | 2 +- src/Fixer/Alias/NoAliasFunctionsFixer.php | 2 +- src/Fixer/Alias/PowToExponentiationFixer.php | 2 +- src/Fixer/Basic/BracesFixer.php | 2 +- .../SingleTraitInsertPerStatementFixer.php | 2 +- src/Fixer/Comment/CommentToPhpdocFixer.php | 1 + src/Fixer/ControlStructure/ElseifFixer.php | 2 +- .../NoAlternativeSyntaxFixer.php | 2 +- .../NoUnneededCurlyBracesFixer.php | 2 +- .../CombineNestedDirnameFixer.php | 2 +- .../FunctionNotation/ImplodeCallFixer.php | 2 +- .../MethodArgumentSpaceFixer.php | 2 +- .../NoUselessSprintfFixer.php | 2 +- .../PhpdocToParamTypeFixer.php | 2 +- .../PhpdocToReturnTypeFixer.php | 2 +- .../LanguageConstruct/DirConstantFixer.php | 2 +- .../Phpdoc/AlignMultilineCommentFixer.php | 4 +-- .../GeneralPhpdocAnnotationRemoveFixer.php | 2 +- .../Phpdoc/GeneralPhpdocTagRenameFixer.php | 2 +- .../Phpdoc/NoBlankLinesAfterPhpdocFixer.php | 2 +- src/Fixer/Phpdoc/NoEmptyPhpdocFixer.php | 2 +- .../Phpdoc/NoSuperfluousPhpdocTagsFixer.php | 2 +- .../PhpdocAddMissingParamAnnotationFixer.php | 2 +- src/Fixer/Phpdoc/PhpdocAlignFixer.php | 2 +- .../PhpdocAnnotationWithoutDotFixer.php | 2 +- src/Fixer/Phpdoc/PhpdocInlineTagFixer.php | 2 +- .../Phpdoc/PhpdocInlineTagNormalizerFixer.php | 2 +- src/Fixer/Phpdoc/PhpdocLineSpanFixer.php | 2 +- src/Fixer/Phpdoc/PhpdocNoAccessFixer.php | 2 +- src/Fixer/Phpdoc/PhpdocNoAliasTagFixer.php | 2 +- src/Fixer/Phpdoc/PhpdocNoEmptyReturnFixer.php | 2 +- src/Fixer/Phpdoc/PhpdocNoPackageFixer.php | 2 +- .../Phpdoc/PhpdocNoUselessInheritdocFixer.php | 2 +- src/Fixer/Phpdoc/PhpdocOrderByValueFixer.php | 2 +- src/Fixer/Phpdoc/PhpdocOrderFixer.php | 2 +- .../Phpdoc/PhpdocReturnSelfReferenceFixer.php | 2 +- src/Fixer/Phpdoc/PhpdocSeparationFixer.php | 2 +- .../PhpdocSingleLineVarSpacingFixer.php | 2 +- src/Fixer/Phpdoc/PhpdocSummaryFixer.php | 2 +- src/Fixer/Phpdoc/PhpdocTagCasingFixer.php | 2 +- src/Fixer/Phpdoc/PhpdocTagTypeFixer.php | 2 +- ...rimConsecutiveBlankLineSeparationFixer.php | 2 +- src/Fixer/Phpdoc/PhpdocTrimFixer.php | 2 +- src/Fixer/Phpdoc/PhpdocTypesOrderFixer.php | 2 +- .../PhpdocVarAnnotationCorrectOrderFixer.php | 2 +- .../Phpdoc/PhpdocVarWithoutNameFixer.php | 2 +- src/Fixer/Semicolon/NoEmptyStatementFixer.php | 2 +- .../Whitespace/ArrayIndentationFixer.php | 2 +- src/Fixer/Whitespace/LineEndingFixer.php | 2 +- .../MethodChainingIndentationFixer.php | 2 +- tests/AutoReview/FixerFactoryTest.php | 18 ++++++----- .../Fixtures/Integration/misc/issue_3879.test | 31 +++++++++++++++++++ 52 files changed, 93 insertions(+), 57 deletions(-) create mode 100644 tests/Fixtures/Integration/misc/issue_3879.test diff --git a/src/AbstractNoUselessElseFixer.php b/src/AbstractNoUselessElseFixer.php index 2810d90bcad..676c970b52e 100644 --- a/src/AbstractNoUselessElseFixer.php +++ b/src/AbstractNoUselessElseFixer.php @@ -25,7 +25,7 @@ abstract class AbstractNoUselessElseFixer extends AbstractFixer public function getPriority() { // should be run before NoWhitespaceInBlankLineFixer, NoExtraBlankLinesFixer, BracesFixer and after NoEmptyStatementFixer. - return 25; + return 39; } /** diff --git a/src/Fixer/Alias/NoAliasFunctionsFixer.php b/src/Fixer/Alias/NoAliasFunctionsFixer.php index 71aff5e339d..f6550741e37 100644 --- a/src/Fixer/Alias/NoAliasFunctionsFixer.php +++ b/src/Fixer/Alias/NoAliasFunctionsFixer.php @@ -178,7 +178,7 @@ public function getDefinition() */ public function getPriority() { - return 0; + return 40; } /** diff --git a/src/Fixer/Alias/PowToExponentiationFixer.php b/src/Fixer/Alias/PowToExponentiationFixer.php index d9d9c7bcba1..214ae6dcb25 100644 --- a/src/Fixer/Alias/PowToExponentiationFixer.php +++ b/src/Fixer/Alias/PowToExponentiationFixer.php @@ -58,7 +58,7 @@ public function getDefinition() */ public function getPriority() { - return 3; + return 32; } /** diff --git a/src/Fixer/Basic/BracesFixer.php b/src/Fixer/Basic/BracesFixer.php index 8f249e10f8e..25ab0aec7b4 100644 --- a/src/Fixer/Basic/BracesFixer.php +++ b/src/Fixer/Basic/BracesFixer.php @@ -130,7 +130,7 @@ public function bar($baz) */ public function getPriority() { - return -25; + return 35; } /** diff --git a/src/Fixer/ClassNotation/SingleTraitInsertPerStatementFixer.php b/src/Fixer/ClassNotation/SingleTraitInsertPerStatementFixer.php index a2419b58289..be7f7d906a6 100644 --- a/src/Fixer/ClassNotation/SingleTraitInsertPerStatementFixer.php +++ b/src/Fixer/ClassNotation/SingleTraitInsertPerStatementFixer.php @@ -49,7 +49,7 @@ final class Example */ public function getPriority() { - return 1; + return 36; } public function isCandidate(Tokens $tokens) diff --git a/src/Fixer/Comment/CommentToPhpdocFixer.php b/src/Fixer/Comment/CommentToPhpdocFixer.php index 42e28e23878..69ae0cc7c9e 100644 --- a/src/Fixer/Comment/CommentToPhpdocFixer.php +++ b/src/Fixer/Comment/CommentToPhpdocFixer.php @@ -55,6 +55,7 @@ public function isRisky() * {@inheritdoc} * * Must run before GeneralPhpdocAnnotationRemoveFixer, GeneralPhpdocTagRenameFixer, NoBlankLinesAfterPhpdocFixer, NoEmptyPhpdocFixer, NoSuperfluousPhpdocTagsFixer, PhpdocAddMissingParamAnnotationFixer, PhpdocAlignFixer, PhpdocAlignFixer, PhpdocAnnotationWithoutDotFixer, PhpdocInlineTagFixer, PhpdocInlineTagNormalizerFixer, PhpdocLineSpanFixer, PhpdocNoAccessFixer, PhpdocNoAliasTagFixer, PhpdocNoEmptyReturnFixer, PhpdocNoPackageFixer, PhpdocNoUselessInheritdocFixer, PhpdocOrderByValueFixer, PhpdocOrderFixer, PhpdocReturnSelfReferenceFixer, PhpdocSeparationFixer, PhpdocSingleLineVarSpacingFixer, PhpdocSummaryFixer, PhpdocTagCasingFixer, PhpdocTagTypeFixer, PhpdocToCommentFixer, PhpdocToParamTypeFixer, PhpdocToReturnTypeFixer, PhpdocTrimConsecutiveBlankLineSeparationFixer, PhpdocTrimFixer, PhpdocTypesOrderFixer, PhpdocVarAnnotationCorrectOrderFixer, PhpdocVarWithoutNameFixer. + * Must run after AlignMultilineCommentFixer. */ public function getPriority() { diff --git a/src/Fixer/ControlStructure/ElseifFixer.php b/src/Fixer/ControlStructure/ElseifFixer.php index bc1598df09e..94670cec68c 100644 --- a/src/Fixer/ControlStructure/ElseifFixer.php +++ b/src/Fixer/ControlStructure/ElseifFixer.php @@ -44,7 +44,7 @@ public function getDefinition() */ public function getPriority() { - return 0; + return 40; } /** diff --git a/src/Fixer/ControlStructure/NoAlternativeSyntaxFixer.php b/src/Fixer/ControlStructure/NoAlternativeSyntaxFixer.php index ee6b7c2fecf..cc95ce7bcad 100644 --- a/src/Fixer/ControlStructure/NoAlternativeSyntaxFixer.php +++ b/src/Fixer/ControlStructure/NoAlternativeSyntaxFixer.php @@ -62,7 +62,7 @@ public function isCandidate(Tokens $tokens) */ public function getPriority() { - return 26; + return 42; } /** diff --git a/src/Fixer/ControlStructure/NoUnneededCurlyBracesFixer.php b/src/Fixer/ControlStructure/NoUnneededCurlyBracesFixer.php index 1f2fba44d9a..3a0b1845ec6 100644 --- a/src/Fixer/ControlStructure/NoUnneededCurlyBracesFixer.php +++ b/src/Fixer/ControlStructure/NoUnneededCurlyBracesFixer.php @@ -65,7 +65,7 @@ function Bar(){} */ public function getPriority() { - return 26; + return 40; } /** diff --git a/src/Fixer/FunctionNotation/CombineNestedDirnameFixer.php b/src/Fixer/FunctionNotation/CombineNestedDirnameFixer.php index d06235f0d63..8d3db7dab97 100644 --- a/src/Fixer/FunctionNotation/CombineNestedDirnameFixer.php +++ b/src/Fixer/FunctionNotation/CombineNestedDirnameFixer.php @@ -67,7 +67,7 @@ public function isRisky() */ public function getPriority() { - return 3; + return 35; } /** diff --git a/src/Fixer/FunctionNotation/ImplodeCallFixer.php b/src/Fixer/FunctionNotation/ImplodeCallFixer.php index e7bf072c6c2..a7bb4ea08cf 100644 --- a/src/Fixer/FunctionNotation/ImplodeCallFixer.php +++ b/src/Fixer/FunctionNotation/ImplodeCallFixer.php @@ -65,7 +65,7 @@ public function isCandidate(Tokens $tokens) */ public function getPriority() { - return -1; + return 37; } /** diff --git a/src/Fixer/FunctionNotation/MethodArgumentSpaceFixer.php b/src/Fixer/FunctionNotation/MethodArgumentSpaceFixer.php index 7fc0202c7d8..e3e02cd1a69 100644 --- a/src/Fixer/FunctionNotation/MethodArgumentSpaceFixer.php +++ b/src/Fixer/FunctionNotation/MethodArgumentSpaceFixer.php @@ -133,7 +133,7 @@ public function configure(array $configuration = null) */ public function getPriority() { - return -30; + return 30; } /** diff --git a/src/Fixer/FunctionNotation/NoUselessSprintfFixer.php b/src/Fixer/FunctionNotation/NoUselessSprintfFixer.php index c67248bbb14..944420f2443 100644 --- a/src/Fixer/FunctionNotation/NoUselessSprintfFixer.php +++ b/src/Fixer/FunctionNotation/NoUselessSprintfFixer.php @@ -61,7 +61,7 @@ public function isRisky() */ public function getPriority() { - return 27; + return 42; } /** diff --git a/src/Fixer/FunctionNotation/PhpdocToParamTypeFixer.php b/src/Fixer/FunctionNotation/PhpdocToParamTypeFixer.php index 94d9dd236ba..a31f229aac8 100644 --- a/src/Fixer/FunctionNotation/PhpdocToParamTypeFixer.php +++ b/src/Fixer/FunctionNotation/PhpdocToParamTypeFixer.php @@ -96,7 +96,7 @@ public function isCandidate(Tokens $tokens) * {@inheritdoc} * * Must run before NoSuperfluousPhpdocTagsFixer, PhpdocAlignFixer. - * Must run after CommentToPhpdocFixer, PhpdocIndentFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer. + * Must run after AlignMultilineCommentFixer, CommentToPhpdocFixer, PhpdocIndentFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer. */ public function getPriority() { diff --git a/src/Fixer/FunctionNotation/PhpdocToReturnTypeFixer.php b/src/Fixer/FunctionNotation/PhpdocToReturnTypeFixer.php index b70ee72a685..f23d353b020 100644 --- a/src/Fixer/FunctionNotation/PhpdocToReturnTypeFixer.php +++ b/src/Fixer/FunctionNotation/PhpdocToReturnTypeFixer.php @@ -155,7 +155,7 @@ public function isCandidate(Tokens $tokens) * {@inheritdoc} * * Must run before FullyQualifiedStrictTypesFixer, NoSuperfluousPhpdocTagsFixer, PhpdocAlignFixer, ReturnTypeDeclarationFixer. - * Must run after CommentToPhpdocFixer, PhpdocIndentFixer, PhpdocScalarFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer, PhpdocTypesFixer. + * Must run after AlignMultilineCommentFixer, CommentToPhpdocFixer, PhpdocIndentFixer, PhpdocScalarFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer, PhpdocTypesFixer. */ public function getPriority() { diff --git a/src/Fixer/LanguageConstruct/DirConstantFixer.php b/src/Fixer/LanguageConstruct/DirConstantFixer.php index c9567b65ea2..2d5ead81527 100644 --- a/src/Fixer/LanguageConstruct/DirConstantFixer.php +++ b/src/Fixer/LanguageConstruct/DirConstantFixer.php @@ -51,7 +51,7 @@ public function isCandidate(Tokens $tokens) */ public function getPriority() { - return 4; + return 40; } /** diff --git a/src/Fixer/Phpdoc/AlignMultilineCommentFixer.php b/src/Fixer/Phpdoc/AlignMultilineCommentFixer.php index 8ef7f0b0516..66265280f3b 100644 --- a/src/Fixer/Phpdoc/AlignMultilineCommentFixer.php +++ b/src/Fixer/Phpdoc/AlignMultilineCommentFixer.php @@ -86,12 +86,12 @@ public function getDefinition() /** * {@inheritdoc} * - * Must run before PhpdocTrimConsecutiveBlankLineSeparationFixer. + * Must run before CommentToPhpdocFixer, GeneralPhpdocAnnotationRemoveFixer, GeneralPhpdocTagRenameFixer, NoBlankLinesAfterPhpdocFixer, NoEmptyPhpdocFixer, NoSuperfluousPhpdocTagsFixer, PhpdocAddMissingParamAnnotationFixer, PhpdocAlignFixer, PhpdocAnnotationWithoutDotFixer, PhpdocInlineTagFixer, PhpdocInlineTagNormalizerFixer, PhpdocLineSpanFixer, PhpdocNoAccessFixer, PhpdocNoAliasTagFixer, PhpdocNoEmptyReturnFixer, PhpdocNoPackageFixer, PhpdocNoUselessInheritdocFixer, PhpdocOrderByValueFixer, PhpdocOrderFixer, PhpdocReturnSelfReferenceFixer, PhpdocSeparationFixer, PhpdocSingleLineVarSpacingFixer, PhpdocSummaryFixer, PhpdocTagCasingFixer, PhpdocTagTypeFixer, PhpdocToParamTypeFixer, PhpdocToReturnTypeFixer, PhpdocTrimConsecutiveBlankLineSeparationFixer, PhpdocTrimConsecutiveBlankLineSeparationFixer, PhpdocTrimFixer, PhpdocTypesOrderFixer, PhpdocVarAnnotationCorrectOrderFixer, PhpdocVarWithoutNameFixer. * Must run after ArrayIndentationFixer. */ public function getPriority() { - return -40; + return 27; } /** diff --git a/src/Fixer/Phpdoc/GeneralPhpdocAnnotationRemoveFixer.php b/src/Fixer/Phpdoc/GeneralPhpdocAnnotationRemoveFixer.php index 4a52d975038..f86027cd9fa 100644 --- a/src/Fixer/Phpdoc/GeneralPhpdocAnnotationRemoveFixer.php +++ b/src/Fixer/Phpdoc/GeneralPhpdocAnnotationRemoveFixer.php @@ -66,7 +66,7 @@ function foo() {} * {@inheritdoc} * * Must run before NoEmptyPhpdocFixer, PhpdocAlignFixer, PhpdocLineSpanFixer, PhpdocSeparationFixer, PhpdocTrimFixer. - * Must run after CommentToPhpdocFixer, PhpdocIndentFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer. + * Must run after AlignMultilineCommentFixer, CommentToPhpdocFixer, PhpdocIndentFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer. */ public function getPriority() { diff --git a/src/Fixer/Phpdoc/GeneralPhpdocTagRenameFixer.php b/src/Fixer/Phpdoc/GeneralPhpdocTagRenameFixer.php index 2910b87559f..20c07a095e6 100644 --- a/src/Fixer/Phpdoc/GeneralPhpdocTagRenameFixer.php +++ b/src/Fixer/Phpdoc/GeneralPhpdocTagRenameFixer.php @@ -65,7 +65,7 @@ public function getDefinition() * {@inheritdoc} * * Must run before PhpdocAddMissingParamAnnotationFixer, PhpdocAlignFixer. - * Must run after CommentToPhpdocFixer, PhpdocIndentFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer. + * Must run after AlignMultilineCommentFixer, CommentToPhpdocFixer, PhpdocIndentFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer. */ public function getPriority() { diff --git a/src/Fixer/Phpdoc/NoBlankLinesAfterPhpdocFixer.php b/src/Fixer/Phpdoc/NoBlankLinesAfterPhpdocFixer.php index 451f8e1e551..4bb68efb5a1 100644 --- a/src/Fixer/Phpdoc/NoBlankLinesAfterPhpdocFixer.php +++ b/src/Fixer/Phpdoc/NoBlankLinesAfterPhpdocFixer.php @@ -58,7 +58,7 @@ class Bar {} * {@inheritdoc} * * Must run before HeaderCommentFixer, PhpdocAlignFixer, SingleBlankLineBeforeNamespaceFixer. - * Must run after CommentToPhpdocFixer, PhpdocIndentFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer. + * Must run after AlignMultilineCommentFixer, CommentToPhpdocFixer, PhpdocIndentFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer. */ public function getPriority() { diff --git a/src/Fixer/Phpdoc/NoEmptyPhpdocFixer.php b/src/Fixer/Phpdoc/NoEmptyPhpdocFixer.php index 2e3feedd7e7..eb846120aa5 100644 --- a/src/Fixer/Phpdoc/NoEmptyPhpdocFixer.php +++ b/src/Fixer/Phpdoc/NoEmptyPhpdocFixer.php @@ -38,7 +38,7 @@ public function getDefinition() * {@inheritdoc} * * Must run before NoExtraBlankLinesFixer, NoTrailingWhitespaceFixer, NoWhitespaceInBlankLineFixer, PhpdocAlignFixer. - * Must run after CommentToPhpdocFixer, GeneralPhpdocAnnotationRemoveFixer, NoSuperfluousPhpdocTagsFixer, PhpUnitNoExpectationAnnotationFixer, PhpUnitTestAnnotationFixer, PhpdocAddMissingParamAnnotationFixer, PhpdocIndentFixer, PhpdocNoAccessFixer, PhpdocNoEmptyReturnFixer, PhpdocNoPackageFixer, PhpdocNoUselessInheritdocFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer. + * Must run after AlignMultilineCommentFixer, CommentToPhpdocFixer, GeneralPhpdocAnnotationRemoveFixer, NoSuperfluousPhpdocTagsFixer, PhpUnitNoExpectationAnnotationFixer, PhpUnitTestAnnotationFixer, PhpdocAddMissingParamAnnotationFixer, PhpdocIndentFixer, PhpdocNoAccessFixer, PhpdocNoEmptyReturnFixer, PhpdocNoPackageFixer, PhpdocNoUselessInheritdocFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer. */ public function getPriority() { diff --git a/src/Fixer/Phpdoc/NoSuperfluousPhpdocTagsFixer.php b/src/Fixer/Phpdoc/NoSuperfluousPhpdocTagsFixer.php index 4a472916a48..06ec8845596 100644 --- a/src/Fixer/Phpdoc/NoSuperfluousPhpdocTagsFixer.php +++ b/src/Fixer/Phpdoc/NoSuperfluousPhpdocTagsFixer.php @@ -93,7 +93,7 @@ public function doFoo(Bar $bar, $baz /*, $qux = null */) {} * {@inheritdoc} * * Must run before NoEmptyPhpdocFixer, PhpdocAlignFixer, VoidReturnFixer. - * Must run after CommentToPhpdocFixer, FullyQualifiedStrictTypesFixer, PhpdocAddMissingParamAnnotationFixer, PhpdocIndentFixer, PhpdocReturnSelfReferenceFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocToParamTypeFixer, PhpdocToReturnTypeFixer, PhpdocTypesFixer. + * Must run after AlignMultilineCommentFixer, CommentToPhpdocFixer, FullyQualifiedStrictTypesFixer, PhpdocAddMissingParamAnnotationFixer, PhpdocIndentFixer, PhpdocReturnSelfReferenceFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocToParamTypeFixer, PhpdocToReturnTypeFixer, PhpdocTypesFixer. */ public function getPriority() { diff --git a/src/Fixer/Phpdoc/PhpdocAddMissingParamAnnotationFixer.php b/src/Fixer/Phpdoc/PhpdocAddMissingParamAnnotationFixer.php index f9b1c0eaf0a..50a5e43cb5e 100644 --- a/src/Fixer/Phpdoc/PhpdocAddMissingParamAnnotationFixer.php +++ b/src/Fixer/Phpdoc/PhpdocAddMissingParamAnnotationFixer.php @@ -79,7 +79,7 @@ function f9(string $foo, $bar, $baz) {} * {@inheritdoc} * * Must run before NoEmptyPhpdocFixer, NoSuperfluousPhpdocTagsFixer, PhpdocAlignFixer, PhpdocAlignFixer, PhpdocOrderFixer. - * Must run after CommentToPhpdocFixer, GeneralPhpdocTagRenameFixer, PhpdocIndentFixer, PhpdocNoAliasTagFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer. + * Must run after AlignMultilineCommentFixer, CommentToPhpdocFixer, GeneralPhpdocTagRenameFixer, PhpdocIndentFixer, PhpdocNoAliasTagFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer. */ public function getPriority() { diff --git a/src/Fixer/Phpdoc/PhpdocAlignFixer.php b/src/Fixer/Phpdoc/PhpdocAlignFixer.php index fac3c721795..7b2afd325ae 100644 --- a/src/Fixer/Phpdoc/PhpdocAlignFixer.php +++ b/src/Fixer/Phpdoc/PhpdocAlignFixer.php @@ -146,7 +146,7 @@ public function getDefinition() /** * {@inheritdoc} * - * Must run after CommentToPhpdocFixer, CommentToPhpdocFixer, GeneralPhpdocAnnotationRemoveFixer, GeneralPhpdocTagRenameFixer, NoBlankLinesAfterPhpdocFixer, NoEmptyPhpdocFixer, NoSuperfluousPhpdocTagsFixer, PhpdocAddMissingParamAnnotationFixer, PhpdocAddMissingParamAnnotationFixer, PhpdocAnnotationWithoutDotFixer, PhpdocIndentFixer, PhpdocIndentFixer, PhpdocInlineTagFixer, PhpdocInlineTagNormalizerFixer, PhpdocLineSpanFixer, PhpdocNoAccessFixer, PhpdocNoAliasTagFixer, PhpdocNoEmptyReturnFixer, PhpdocNoPackageFixer, PhpdocNoUselessInheritdocFixer, PhpdocOrderByValueFixer, PhpdocOrderFixer, PhpdocReturnSelfReferenceFixer, PhpdocScalarFixer, PhpdocScalarFixer, PhpdocSeparationFixer, PhpdocSingleLineVarSpacingFixer, PhpdocSummaryFixer, PhpdocTagCasingFixer, PhpdocTagTypeFixer, PhpdocToCommentFixer, PhpdocToCommentFixer, PhpdocToParamTypeFixer, PhpdocToReturnTypeFixer, PhpdocTrimConsecutiveBlankLineSeparationFixer, PhpdocTrimFixer, PhpdocTypesFixer, PhpdocTypesFixer, PhpdocTypesOrderFixer, PhpdocVarAnnotationCorrectOrderFixer, PhpdocVarWithoutNameFixer. + * Must run after AlignMultilineCommentFixer, CommentToPhpdocFixer, CommentToPhpdocFixer, GeneralPhpdocAnnotationRemoveFixer, GeneralPhpdocTagRenameFixer, NoBlankLinesAfterPhpdocFixer, NoEmptyPhpdocFixer, NoSuperfluousPhpdocTagsFixer, PhpdocAddMissingParamAnnotationFixer, PhpdocAddMissingParamAnnotationFixer, PhpdocAnnotationWithoutDotFixer, PhpdocIndentFixer, PhpdocIndentFixer, PhpdocInlineTagFixer, PhpdocInlineTagNormalizerFixer, PhpdocLineSpanFixer, PhpdocNoAccessFixer, PhpdocNoAliasTagFixer, PhpdocNoEmptyReturnFixer, PhpdocNoPackageFixer, PhpdocNoUselessInheritdocFixer, PhpdocOrderByValueFixer, PhpdocOrderFixer, PhpdocReturnSelfReferenceFixer, PhpdocScalarFixer, PhpdocScalarFixer, PhpdocSeparationFixer, PhpdocSingleLineVarSpacingFixer, PhpdocSummaryFixer, PhpdocTagCasingFixer, PhpdocTagTypeFixer, PhpdocToCommentFixer, PhpdocToCommentFixer, PhpdocToParamTypeFixer, PhpdocToReturnTypeFixer, PhpdocTrimConsecutiveBlankLineSeparationFixer, PhpdocTrimFixer, PhpdocTypesFixer, PhpdocTypesFixer, PhpdocTypesOrderFixer, PhpdocVarAnnotationCorrectOrderFixer, PhpdocVarWithoutNameFixer. */ public function getPriority() { diff --git a/src/Fixer/Phpdoc/PhpdocAnnotationWithoutDotFixer.php b/src/Fixer/Phpdoc/PhpdocAnnotationWithoutDotFixer.php index 82816f192f8..02ad66862d5 100644 --- a/src/Fixer/Phpdoc/PhpdocAnnotationWithoutDotFixer.php +++ b/src/Fixer/Phpdoc/PhpdocAnnotationWithoutDotFixer.php @@ -47,7 +47,7 @@ function foo ($bar) {} * {@inheritdoc} * * Must run before PhpdocAlignFixer, PhpdocTypesFixer, PhpdocTypesOrderFixer. - * Must run after CommentToPhpdocFixer, PhpdocIndentFixer, PhpdocToCommentFixer. + * Must run after AlignMultilineCommentFixer, CommentToPhpdocFixer, PhpdocIndentFixer, PhpdocToCommentFixer. */ public function getPriority() { diff --git a/src/Fixer/Phpdoc/PhpdocInlineTagFixer.php b/src/Fixer/Phpdoc/PhpdocInlineTagFixer.php index 85059293e0a..22380e54dd0 100644 --- a/src/Fixer/Phpdoc/PhpdocInlineTagFixer.php +++ b/src/Fixer/Phpdoc/PhpdocInlineTagFixer.php @@ -58,7 +58,7 @@ public function getDefinition() * {@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() { diff --git a/src/Fixer/Phpdoc/PhpdocInlineTagNormalizerFixer.php b/src/Fixer/Phpdoc/PhpdocInlineTagNormalizerFixer.php index 7ac7d370770..2c0e5a98b2d 100644 --- a/src/Fixer/Phpdoc/PhpdocInlineTagNormalizerFixer.php +++ b/src/Fixer/Phpdoc/PhpdocInlineTagNormalizerFixer.php @@ -58,7 +58,7 @@ public function getDefinition() * {@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() { diff --git a/src/Fixer/Phpdoc/PhpdocLineSpanFixer.php b/src/Fixer/Phpdoc/PhpdocLineSpanFixer.php index a56208ce076..fb8633d23f7 100644 --- a/src/Fixer/Phpdoc/PhpdocLineSpanFixer.php +++ b/src/Fixer/Phpdoc/PhpdocLineSpanFixer.php @@ -52,7 +52,7 @@ public function getDefinition() * {@inheritdoc} * * Must run before PhpdocAlignFixer. - * Must run after CommentToPhpdocFixer, GeneralPhpdocAnnotationRemoveFixer, PhpdocIndentFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer. + * Must run after AlignMultilineCommentFixer, CommentToPhpdocFixer, GeneralPhpdocAnnotationRemoveFixer, PhpdocIndentFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer. */ public function getPriority() { diff --git a/src/Fixer/Phpdoc/PhpdocNoAccessFixer.php b/src/Fixer/Phpdoc/PhpdocNoAccessFixer.php index a079e871cbc..a1004609e8e 100644 --- a/src/Fixer/Phpdoc/PhpdocNoAccessFixer.php +++ b/src/Fixer/Phpdoc/PhpdocNoAccessFixer.php @@ -50,7 +50,7 @@ class Foo * {@inheritdoc} * * Must run before NoEmptyPhpdocFixer, PhpdocAlignFixer, PhpdocSeparationFixer, PhpdocTrimFixer. - * Must run after CommentToPhpdocFixer, PhpdocIndentFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer. + * Must run after AlignMultilineCommentFixer, CommentToPhpdocFixer, PhpdocIndentFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer. */ public function getPriority() { diff --git a/src/Fixer/Phpdoc/PhpdocNoAliasTagFixer.php b/src/Fixer/Phpdoc/PhpdocNoAliasTagFixer.php index 140d6ada21b..8c774ebe712 100644 --- a/src/Fixer/Phpdoc/PhpdocNoAliasTagFixer.php +++ b/src/Fixer/Phpdoc/PhpdocNoAliasTagFixer.php @@ -74,7 +74,7 @@ final class Example * {@inheritdoc} * * Must run before PhpdocAddMissingParamAnnotationFixer, PhpdocAlignFixer, PhpdocSingleLineVarSpacingFixer. - * Must run after CommentToPhpdocFixer, PhpdocIndentFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer. + * Must run after AlignMultilineCommentFixer, CommentToPhpdocFixer, PhpdocIndentFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer. */ public function getPriority() { diff --git a/src/Fixer/Phpdoc/PhpdocNoEmptyReturnFixer.php b/src/Fixer/Phpdoc/PhpdocNoEmptyReturnFixer.php index 2e394e3c1f0..a721da24ae8 100644 --- a/src/Fixer/Phpdoc/PhpdocNoEmptyReturnFixer.php +++ b/src/Fixer/Phpdoc/PhpdocNoEmptyReturnFixer.php @@ -65,7 +65,7 @@ function foo() {} * {@inheritdoc} * * Must run before NoEmptyPhpdocFixer, PhpdocAlignFixer, PhpdocOrderFixer, PhpdocSeparationFixer, PhpdocTrimFixer. - * Must run after CommentToPhpdocFixer, PhpdocIndentFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer, VoidReturnFixer. + * Must run after AlignMultilineCommentFixer, CommentToPhpdocFixer, PhpdocIndentFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer, VoidReturnFixer. */ public function getPriority() { diff --git a/src/Fixer/Phpdoc/PhpdocNoPackageFixer.php b/src/Fixer/Phpdoc/PhpdocNoPackageFixer.php index 4d67215c8ff..f74cd0eae1b 100644 --- a/src/Fixer/Phpdoc/PhpdocNoPackageFixer.php +++ b/src/Fixer/Phpdoc/PhpdocNoPackageFixer.php @@ -50,7 +50,7 @@ class Baz * {@inheritdoc} * * Must run before NoEmptyPhpdocFixer, PhpdocAlignFixer, PhpdocSeparationFixer, PhpdocTrimFixer. - * Must run after CommentToPhpdocFixer, PhpdocIndentFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer. + * Must run after AlignMultilineCommentFixer, CommentToPhpdocFixer, PhpdocIndentFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer. */ public function getPriority() { diff --git a/src/Fixer/Phpdoc/PhpdocNoUselessInheritdocFixer.php b/src/Fixer/Phpdoc/PhpdocNoUselessInheritdocFixer.php index cfd67353b3c..6b0e6ae66dc 100644 --- a/src/Fixer/Phpdoc/PhpdocNoUselessInheritdocFixer.php +++ b/src/Fixer/Phpdoc/PhpdocNoUselessInheritdocFixer.php @@ -45,7 +45,7 @@ public function getDefinition() * {@inheritdoc} * * Must run before NoEmptyPhpdocFixer, NoTrailingWhitespaceInCommentFixer, PhpdocAlignFixer. - * Must run after CommentToPhpdocFixer, PhpdocIndentFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocToCommentFixer, PhpdocTypesFixer. + * Must run after AlignMultilineCommentFixer, CommentToPhpdocFixer, PhpdocIndentFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocToCommentFixer, PhpdocTypesFixer. */ public function getPriority() { diff --git a/src/Fixer/Phpdoc/PhpdocOrderByValueFixer.php b/src/Fixer/Phpdoc/PhpdocOrderByValueFixer.php index ffaeceedd14..c783914c1da 100644 --- a/src/Fixer/Phpdoc/PhpdocOrderByValueFixer.php +++ b/src/Fixer/Phpdoc/PhpdocOrderByValueFixer.php @@ -72,7 +72,7 @@ final class MyTest extends \PHPUnit_Framework_TestCase * {@inheritdoc} * * Must run before PhpdocAlignFixer. - * Must run after CommentToPhpdocFixer, PhpUnitFqcnAnnotationFixer, PhpdocIndentFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer. + * Must run after AlignMultilineCommentFixer, CommentToPhpdocFixer, PhpUnitFqcnAnnotationFixer, PhpdocIndentFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer. */ public function getPriority() { diff --git a/src/Fixer/Phpdoc/PhpdocOrderFixer.php b/src/Fixer/Phpdoc/PhpdocOrderFixer.php index 5401b3fde3c..fc91375f52e 100644 --- a/src/Fixer/Phpdoc/PhpdocOrderFixer.php +++ b/src/Fixer/Phpdoc/PhpdocOrderFixer.php @@ -61,7 +61,7 @@ public function getDefinition() * {@inheritdoc} * * Must run before PhpdocAlignFixer, PhpdocSeparationFixer, PhpdocTrimFixer. - * Must run after CommentToPhpdocFixer, PhpdocAddMissingParamAnnotationFixer, PhpdocIndentFixer, PhpdocNoEmptyReturnFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer. + * Must run after AlignMultilineCommentFixer, CommentToPhpdocFixer, PhpdocAddMissingParamAnnotationFixer, PhpdocIndentFixer, PhpdocNoEmptyReturnFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer. */ public function getPriority() { diff --git a/src/Fixer/Phpdoc/PhpdocReturnSelfReferenceFixer.php b/src/Fixer/Phpdoc/PhpdocReturnSelfReferenceFixer.php index 5f6c8a4b0b6..b54a44d20de 100644 --- a/src/Fixer/Phpdoc/PhpdocReturnSelfReferenceFixer.php +++ b/src/Fixer/Phpdoc/PhpdocReturnSelfReferenceFixer.php @@ -105,7 +105,7 @@ public function isCandidate(Tokens $tokens) * {@inheritdoc} * * Must run before NoSuperfluousPhpdocTagsFixer, PhpdocAlignFixer. - * Must run after CommentToPhpdocFixer, PhpdocIndentFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer. + * Must run after AlignMultilineCommentFixer, CommentToPhpdocFixer, PhpdocIndentFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer. */ public function getPriority() { diff --git a/src/Fixer/Phpdoc/PhpdocSeparationFixer.php b/src/Fixer/Phpdoc/PhpdocSeparationFixer.php index 2ecb34db283..7da076281f1 100644 --- a/src/Fixer/Phpdoc/PhpdocSeparationFixer.php +++ b/src/Fixer/Phpdoc/PhpdocSeparationFixer.php @@ -56,7 +56,7 @@ function fnc($foo, $bar) {} * {@inheritdoc} * * Must run before PhpdocAlignFixer. - * Must run after CommentToPhpdocFixer, GeneralPhpdocAnnotationRemoveFixer, PhpdocIndentFixer, PhpdocNoAccessFixer, PhpdocNoEmptyReturnFixer, PhpdocNoPackageFixer, PhpdocOrderFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer. + * Must run after AlignMultilineCommentFixer, CommentToPhpdocFixer, GeneralPhpdocAnnotationRemoveFixer, PhpdocIndentFixer, PhpdocNoAccessFixer, PhpdocNoEmptyReturnFixer, PhpdocNoPackageFixer, PhpdocOrderFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer. */ public function getPriority() { diff --git a/src/Fixer/Phpdoc/PhpdocSingleLineVarSpacingFixer.php b/src/Fixer/Phpdoc/PhpdocSingleLineVarSpacingFixer.php index 9cb6f325f42..5196bd787dd 100644 --- a/src/Fixer/Phpdoc/PhpdocSingleLineVarSpacingFixer.php +++ b/src/Fixer/Phpdoc/PhpdocSingleLineVarSpacingFixer.php @@ -41,7 +41,7 @@ public function getDefinition() * {@inheritdoc} * * Must run before PhpdocAlignFixer. - * Must run after CommentToPhpdocFixer, PhpdocIndentFixer, PhpdocNoAliasTagFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer. + * Must run after AlignMultilineCommentFixer, CommentToPhpdocFixer, PhpdocIndentFixer, PhpdocNoAliasTagFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer. */ public function getPriority() { diff --git a/src/Fixer/Phpdoc/PhpdocSummaryFixer.php b/src/Fixer/Phpdoc/PhpdocSummaryFixer.php index 3192f28c102..23e9bf20b6a 100644 --- a/src/Fixer/Phpdoc/PhpdocSummaryFixer.php +++ b/src/Fixer/Phpdoc/PhpdocSummaryFixer.php @@ -46,7 +46,7 @@ function 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() { diff --git a/src/Fixer/Phpdoc/PhpdocTagCasingFixer.php b/src/Fixer/Phpdoc/PhpdocTagCasingFixer.php index f38a8c2999f..51b362c09d0 100644 --- a/src/Fixer/Phpdoc/PhpdocTagCasingFixer.php +++ b/src/Fixer/Phpdoc/PhpdocTagCasingFixer.php @@ -44,7 +44,7 @@ public function getDefinition() * {@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() { diff --git a/src/Fixer/Phpdoc/PhpdocTagTypeFixer.php b/src/Fixer/Phpdoc/PhpdocTagTypeFixer.php index 80d2e9045e9..6289fc44208 100644 --- a/src/Fixer/Phpdoc/PhpdocTagTypeFixer.php +++ b/src/Fixer/Phpdoc/PhpdocTagTypeFixer.php @@ -60,7 +60,7 @@ public function getDefinition() * {@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() { diff --git a/src/Fixer/Phpdoc/PhpdocTrimConsecutiveBlankLineSeparationFixer.php b/src/Fixer/Phpdoc/PhpdocTrimConsecutiveBlankLineSeparationFixer.php index edf17593c06..f37a55f463d 100644 --- a/src/Fixer/Phpdoc/PhpdocTrimConsecutiveBlankLineSeparationFixer.php +++ b/src/Fixer/Phpdoc/PhpdocTrimConsecutiveBlankLineSeparationFixer.php @@ -63,7 +63,7 @@ function fnc($foo) {} * {@inheritdoc} * * Must run before PhpdocAlignFixer. - * Must run after AlignMultilineCommentFixer, CommentToPhpdocFixer, PhpdocIndentFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer. + * Must run after AlignMultilineCommentFixer, AlignMultilineCommentFixer, CommentToPhpdocFixer, PhpdocIndentFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer. */ public function getPriority() { diff --git a/src/Fixer/Phpdoc/PhpdocTrimFixer.php b/src/Fixer/Phpdoc/PhpdocTrimFixer.php index 6fd5512ef5f..7bd8e150b3c 100644 --- a/src/Fixer/Phpdoc/PhpdocTrimFixer.php +++ b/src/Fixer/Phpdoc/PhpdocTrimFixer.php @@ -47,7 +47,7 @@ final class Foo {} * {@inheritdoc} * * Must run before PhpdocAlignFixer. - * Must run after CommentToPhpdocFixer, GeneralPhpdocAnnotationRemoveFixer, PhpUnitTestAnnotationFixer, PhpdocIndentFixer, PhpdocNoAccessFixer, PhpdocNoEmptyReturnFixer, PhpdocNoPackageFixer, PhpdocOrderFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer. + * Must run after AlignMultilineCommentFixer, CommentToPhpdocFixer, GeneralPhpdocAnnotationRemoveFixer, PhpUnitTestAnnotationFixer, PhpdocIndentFixer, PhpdocNoAccessFixer, PhpdocNoEmptyReturnFixer, PhpdocNoPackageFixer, PhpdocOrderFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer. */ public function getPriority() { diff --git a/src/Fixer/Phpdoc/PhpdocTypesOrderFixer.php b/src/Fixer/Phpdoc/PhpdocTypesOrderFixer.php index 6d8b05f0b0d..5b3ea0c7e36 100644 --- a/src/Fixer/Phpdoc/PhpdocTypesOrderFixer.php +++ b/src/Fixer/Phpdoc/PhpdocTypesOrderFixer.php @@ -88,7 +88,7 @@ public function getDefinition() * {@inheritdoc} * * Must run before PhpdocAlignFixer. - * Must run after CommentToPhpdocFixer, PhpdocAnnotationWithoutDotFixer, PhpdocIndentFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer. + * Must run after AlignMultilineCommentFixer, CommentToPhpdocFixer, PhpdocAnnotationWithoutDotFixer, PhpdocIndentFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer. */ public function getPriority() { diff --git a/src/Fixer/Phpdoc/PhpdocVarAnnotationCorrectOrderFixer.php b/src/Fixer/Phpdoc/PhpdocVarAnnotationCorrectOrderFixer.php index 403e6475385..269f4110341 100644 --- a/src/Fixer/Phpdoc/PhpdocVarAnnotationCorrectOrderFixer.php +++ b/src/Fixer/Phpdoc/PhpdocVarAnnotationCorrectOrderFixer.php @@ -39,7 +39,7 @@ public function getDefinition() * {@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() { diff --git a/src/Fixer/Phpdoc/PhpdocVarWithoutNameFixer.php b/src/Fixer/Phpdoc/PhpdocVarWithoutNameFixer.php index 54b820e53a9..58f407c40dd 100644 --- a/src/Fixer/Phpdoc/PhpdocVarWithoutNameFixer.php +++ b/src/Fixer/Phpdoc/PhpdocVarWithoutNameFixer.php @@ -55,7 +55,7 @@ final class 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() { diff --git a/src/Fixer/Semicolon/NoEmptyStatementFixer.php b/src/Fixer/Semicolon/NoEmptyStatementFixer.php index f4c3ab32407..a51de8db9dc 100644 --- a/src/Fixer/Semicolon/NoEmptyStatementFixer.php +++ b/src/Fixer/Semicolon/NoEmptyStatementFixer.php @@ -47,7 +47,7 @@ public function getDefinition() */ public function getPriority() { - return 26; + return 40; } /** diff --git a/src/Fixer/Whitespace/ArrayIndentationFixer.php b/src/Fixer/Whitespace/ArrayIndentationFixer.php index 5bd2121b614..d2afdf7fae4 100644 --- a/src/Fixer/Whitespace/ArrayIndentationFixer.php +++ b/src/Fixer/Whitespace/ArrayIndentationFixer.php @@ -52,7 +52,7 @@ public function isCandidate(Tokens $tokens) */ public function getPriority() { - return -31; + return 29; } protected function applyFix(\SplFileInfo $file, Tokens $tokens) diff --git a/src/Fixer/Whitespace/LineEndingFixer.php b/src/Fixer/Whitespace/LineEndingFixer.php index 0157c8482de..27e69fd8d3b 100644 --- a/src/Fixer/Whitespace/LineEndingFixer.php +++ b/src/Fixer/Whitespace/LineEndingFixer.php @@ -59,7 +59,7 @@ public function getDefinition() */ public function getPriority() { - return 0; + return 40; } /** diff --git a/src/Fixer/Whitespace/MethodChainingIndentationFixer.php b/src/Fixer/Whitespace/MethodChainingIndentationFixer.php index b48b41ea595..4e0320638b3 100644 --- a/src/Fixer/Whitespace/MethodChainingIndentationFixer.php +++ b/src/Fixer/Whitespace/MethodChainingIndentationFixer.php @@ -45,7 +45,7 @@ public function getDefinition() */ public function getPriority() { - return -29; + return 34; } /** diff --git a/tests/AutoReview/FixerFactoryTest.php b/tests/AutoReview/FixerFactoryTest.php index dcc8d1645fd..5beb95ed5b7 100644 --- a/tests/AutoReview/FixerFactoryTest.php +++ b/tests/AutoReview/FixerFactoryTest.php @@ -294,16 +294,19 @@ public function provideFixersPrioritySpecialPhpdocCases() $cases = []; - // prepare bulk tests for phpdoc fixers to test that: - // * `comment_to_phpdoc` is first - // * `phpdoc_to_comment` is second - // * `phpdoc_indent` is third - // * `phpdoc_types` is fourth - // * `phpdoc_scalar` is fifth + // Prepare bulk tests for phpdoc fixers to test that: + // * `align_multiline_comment` is first + // * `comment_to_phpdoc` is second + // * `phpdoc_to_comment` is third + // * `phpdoc_indent` is fourth + // * `phpdoc_types` is fifth + // * `phpdoc_scalar` is sixth // * `phpdoc_align` is last + // Add these cases in test-order instead of alphabetical + $cases[] = [$fixers['align_multiline_comment'], $fixers['comment_to_phpdoc']]; $cases[] = [$fixers['comment_to_phpdoc'], $fixers['phpdoc_to_comment']]; - $cases[] = [$fixers['phpdoc_indent'], $fixers['phpdoc_types']]; $cases[] = [$fixers['phpdoc_to_comment'], $fixers['phpdoc_indent']]; + $cases[] = [$fixers['phpdoc_indent'], $fixers['phpdoc_types']]; $cases[] = [$fixers['phpdoc_types'], $fixers['phpdoc_scalar']]; $docFixerNames = array_filter( @@ -315,6 +318,7 @@ static function ($name) { foreach ($docFixerNames as $docFixerName) { if (!\in_array($docFixerName, ['comment_to_phpdoc', 'phpdoc_to_comment', 'phpdoc_indent', 'phpdoc_types', 'phpdoc_scalar'], true)) { + $cases[] = [$fixers['align_multiline_comment'], $fixers[$docFixerName]]; $cases[] = [$fixers['comment_to_phpdoc'], $fixers[$docFixerName]]; $cases[] = [$fixers['phpdoc_indent'], $fixers[$docFixerName]]; $cases[] = [$fixers['phpdoc_to_comment'], $fixers[$docFixerName]]; diff --git a/tests/Fixtures/Integration/misc/issue_3879.test b/tests/Fixtures/Integration/misc/issue_3879.test new file mode 100644 index 00000000000..6fb353dc248 --- /dev/null +++ b/tests/Fixtures/Integration/misc/issue_3879.test @@ -0,0 +1,31 @@ +--TEST-- +Integration of fixers: align_multiline_comment and PHPDoc rules. +--RULESET-- +{"align_multiline_comment": true, "@PhpCsFixer": true} +--EXPECT-- + Date: Tue, 16 Mar 2021 22:20:51 +0100 Subject: [PATCH 05/10] NullableTypeDeclarationForDefaultNullValueFixer - fix handling promoted properties --- ...ypeDeclarationForDefaultNullValueFixer.php | 16 +++++++++ ...eclarationForDefaultNullValueFixerTest.php | 33 +++++++++++++++++-- 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/src/Fixer/FunctionNotation/NullableTypeDeclarationForDefaultNullValueFixer.php b/src/Fixer/FunctionNotation/NullableTypeDeclarationForDefaultNullValueFixer.php index 8325cd759da..5a73e39c030 100644 --- a/src/Fixer/FunctionNotation/NullableTypeDeclarationForDefaultNullValueFixer.php +++ b/src/Fixer/FunctionNotation/NullableTypeDeclarationForDefaultNullValueFixer.php @@ -139,6 +139,22 @@ private function fixFunctionParameters(Tokens $tokens, array $arguments) } $argumentTypeInfo = $argumentInfo->getTypeAnalysis(); + + if ( + \PHP_VERSION_ID >= 80000 + && false === $this->configuration['use_nullable_type_declaration'] + ) { + $visibility = $tokens[$tokens->getPrevMeaningfulToken($argumentTypeInfo->getStartIndex())]; + + if ($visibility->isGivenKind([ + CT::T_CONSTRUCTOR_PROPERTY_PROMOTION_PUBLIC, + CT::T_CONSTRUCTOR_PROPERTY_PROMOTION_PROTECTED, + CT::T_CONSTRUCTOR_PROPERTY_PROMOTION_PRIVATE, + ])) { + continue; + } + } + if (true === $this->configuration['use_nullable_type_declaration']) { if (!$argumentTypeInfo->isNullable() && 'mixed' !== $argumentTypeInfo->getName()) { $tokens->insertAt($argumentTypeInfo->getStartIndex(), new Token([CT::T_NULLABLE_TYPE, '?'])); diff --git a/tests/Fixer/FunctionNotation/NullableTypeDeclarationForDefaultNullValueFixerTest.php b/tests/Fixer/FunctionNotation/NullableTypeDeclarationForDefaultNullValueFixerTest.php index 7ff546cc429..b6d9c879f6c 100644 --- a/tests/Fixer/FunctionNotation/NullableTypeDeclarationForDefaultNullValueFixerTest.php +++ b/tests/Fixer/FunctionNotation/NullableTypeDeclarationForDefaultNullValueFixerTest.php @@ -406,25 +406,52 @@ public function provideFixPhp74Cases() } /** - * @param string $expected + * @param null|string $expected + * @param string $input + * + * @dataProvider provideFix80Cases + * @requires PHP 8.0 + */ + public function testFix80($input, $expected = null) + { + if (null === $expected) { + $this->doTest($input); + } else { + $this->doTest($expected, $input); + } + } + + /** * @param null|string $input + * @param string $expected * * @dataProvider provideFix80Cases * @requires PHP 8.0 */ - public function testFix80($expected, $input = null) + public function testFixInverse80($expected, $input = null) { + $this->fixer->configure(['use_nullable_type_declaration' => false]); + $this->doTest($expected, $input); } public function provideFix80Cases() { yield 'trailing comma' => [ - ' [ + ' Date: Sat, 23 Jan 2021 11:47:29 +0100 Subject: [PATCH 06/10] NativeFunctionInvocationFixer - PHP 8 attributes --- src/Tokenizer/Analyzer/FunctionsAnalyzer.php | 9 ++++++- .../NativeFunctionInvocationFixerTest.php | 15 ++++++++++++ .../Analyzer/FunctionsAnalyzerTest.php | 24 +++++++++++++------ 3 files changed, 40 insertions(+), 8 deletions(-) diff --git a/src/Tokenizer/Analyzer/FunctionsAnalyzer.php b/src/Tokenizer/Analyzer/FunctionsAnalyzer.php index 8a5b74c6ea7..21f83a1d70f 100644 --- a/src/Tokenizer/Analyzer/FunctionsAnalyzer.php +++ b/src/Tokenizer/Analyzer/FunctionsAnalyzer.php @@ -56,7 +56,14 @@ public function isGlobalFunctionCall(Tokens $tokens, $index) $prevIndex = $tokens->getPrevMeaningfulToken($prevIndex); } - if ($tokens[$prevIndex]->isGivenKind([T_DOUBLE_COLON, T_FUNCTION, CT::T_NAMESPACE_OPERATOR, T_NEW, T_OBJECT_OPERATOR, CT::T_RETURN_REF, T_STRING])) { + $possibleKind = [T_DOUBLE_COLON, T_FUNCTION, CT::T_NAMESPACE_OPERATOR, T_NEW, T_OBJECT_OPERATOR, CT::T_RETURN_REF, T_STRING]; + + // @TODO: drop condition when PHP 8.0+ is required + if (\defined('T_ATTRIBUTE')) { + $possibleKind[] = T_ATTRIBUTE; + } + + if ($tokens[$prevIndex]->isGivenKind($possibleKind)) { return false; } diff --git a/tests/Fixer/FunctionNotation/NativeFunctionInvocationFixerTest.php b/tests/Fixer/FunctionNotation/NativeFunctionInvocationFixerTest.php index 167fe160a05..3d4b78ba6af 100644 --- a/tests/Fixer/FunctionNotation/NativeFunctionInvocationFixerTest.php +++ b/tests/Fixer/FunctionNotation/NativeFunctionInvocationFixerTest.php @@ -645,4 +645,19 @@ public function testFixPrePHP80() ' ); } + + /** + * @requires PHP 8.0 + */ + public function testFixWithAttributesAndStrict() + { + $this->testFixWithConfiguredInclude( + ' true] + ); + } } diff --git a/tests/Tokenizer/Analyzer/FunctionsAnalyzerTest.php b/tests/Tokenizer/Analyzer/FunctionsAnalyzerTest.php index 594d3793525..4f4b73f2a5c 100644 --- a/tests/Tokenizer/Analyzer/FunctionsAnalyzerTest.php +++ b/tests/Tokenizer/Analyzer/FunctionsAnalyzerTest.php @@ -348,32 +348,42 @@ public function provideIsGlobalFunctionCallPhp74Cases() } /** - * @param int[] $globalFunctionIndexes + * @param bool $isFunctionIndex * @param string $code + * @param int $index * * @dataProvider provideIsGlobalFunctionCallPhp80Cases * @requires PHP 8.0 */ - public function testIsGlobalFunctionCallPhp80(array $globalFunctionIndexes, $code) + public function testIsGlobalFunctionCallPhp80($isFunctionIndex, $code, $index) { $tokens = Tokens::fromCode($code); $analyzer = new FunctionsAnalyzer(); - foreach ($globalFunctionIndexes as $index) { - static::assertTrue($analyzer->isGlobalFunctionCall($tokens, $index)); - } + static::assertSame($isFunctionIndex, $analyzer->isGlobalFunctionCall($tokens, $index)); } public function provideIsGlobalFunctionCallPhp80Cases() { yield [ - [8], + true, ' Date: Sat, 9 Jan 2021 16:03:20 +0100 Subject: [PATCH 07/10] PsrAutoloadingFixer - Fix PSR autoloading outside configured directory --- src/Fixer/Basic/PsrAutoloadingFixer.php | 4 ++++ tests/Fixer/Basic/PsrAutoloadingFixerTest.php | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/src/Fixer/Basic/PsrAutoloadingFixer.php b/src/Fixer/Basic/PsrAutoloadingFixer.php index 9187eda6a82..2153abd4c1f 100644 --- a/src/Fixer/Basic/PsrAutoloadingFixer.php +++ b/src/Fixer/Basic/PsrAutoloadingFixer.php @@ -137,6 +137,10 @@ protected function createConfigurationDefinition() */ protected function applyFix(\SplFileInfo $file, Tokens $tokens) { + if (null !== $this->configuration['dir'] && 0 !== strpos($file->getRealPath(), realpath($this->configuration['dir']))) { + return; + } + $namespace = null; $namespaceStartIndex = null; $namespaceEndIndex = null; diff --git a/tests/Fixer/Basic/PsrAutoloadingFixerTest.php b/tests/Fixer/Basic/PsrAutoloadingFixerTest.php index c2a748123ab..25e8516a7e6 100644 --- a/tests/Fixer/Basic/PsrAutoloadingFixerTest.php +++ b/tests/Fixer/Basic/PsrAutoloadingFixerTest.php @@ -103,6 +103,12 @@ public static function provideFixNewCases() __DIR__.'/../..', ]; + yield 'configured directory (other directory)' => [ + ' [ ' Date: Fri, 19 Mar 2021 15:00:36 +0100 Subject: [PATCH 08/10] PsrAutoloadingFixer - call realpath only once --- src/Fixer/Basic/PsrAutoloadingFixer.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Fixer/Basic/PsrAutoloadingFixer.php b/src/Fixer/Basic/PsrAutoloadingFixer.php index 2153abd4c1f..8bb6d2c6b3e 100644 --- a/src/Fixer/Basic/PsrAutoloadingFixer.php +++ b/src/Fixer/Basic/PsrAutoloadingFixer.php @@ -61,6 +61,18 @@ class InvalidName {} ); } + /** + * {@inheritdoc} + */ + public function configure(array $configuration = null) + { + parent::configure($configuration); + + if (null !== $this->configuration['dir']) { + $this->configuration['dir'] = realpath($this->configuration['dir']); + } + } + /** * {@inheritdoc} */ @@ -137,7 +149,7 @@ protected function createConfigurationDefinition() */ protected function applyFix(\SplFileInfo $file, Tokens $tokens) { - if (null !== $this->configuration['dir'] && 0 !== strpos($file->getRealPath(), realpath($this->configuration['dir']))) { + if (null !== $this->configuration['dir'] && 0 !== strpos($file->getRealPath(), $this->configuration['dir'])) { return; } From e0326187520ce098bad34a424669cbc09d610613 Mon Sep 17 00:00:00 2001 From: Dariusz Ruminski Date: Sat, 20 Mar 2021 17:06:31 +0100 Subject: [PATCH 09/10] bumped version --- CHANGELOG.md | 13 +++++++++++++ src/Console/Application.php | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b4529bd1342..a2fb1406925 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,19 @@ CHANGELOG for PHP CS Fixer This file contains changelogs for stable releases only. +Changelog for v2.18.4 +--------------------- + +* bug #4085 Priority: AlignMultilineComment should run before every PhpdocFixer (dmvdbrugge) +* bug #5421 PsrAutoloadingFixer - Fix PSR autoloading outside configured directory (kelunik, keradus) +* bug #5464 NativeFunctionInvocationFixer - PHP 8 attributes (HypeMC, keradus) +* bug #5548 NullableTypeDeclarationForDefaultNullValueFixer - fix handling promoted properties (jrmajor, keradus) +* bug #5550 TypeAlternationTransformer - fix for typed static properties (kubawerlos) +* bug #5551 ClassAttributesSeparationFixer - fix for properties with type alternation (kubawerlos, keradus) +* bug #5552 DX: test relation between function_declaration and method_argument_space (keradus) +* minor #5540 DX: RuleSet - convert null handling to soft-warning (keradus) +* minor #5545 DX: update checkbashisms (keradus) + Changelog for v2.18.3 --------------------- diff --git a/src/Console/Application.php b/src/Console/Application.php index f270459721c..b00bf2a5b77 100644 --- a/src/Console/Application.php +++ b/src/Console/Application.php @@ -34,7 +34,7 @@ */ final class Application extends BaseApplication { - const VERSION = '2.18.4-DEV'; + const VERSION = '2.18.4'; const VERSION_CODENAME = 'Remote Void'; /** From c40975866e753a724377af50de9148a36be9179e Mon Sep 17 00:00:00 2001 From: Dariusz Ruminski Date: Sat, 20 Mar 2021 17:06:38 +0100 Subject: [PATCH 10/10] bumped version --- src/Console/Application.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Console/Application.php b/src/Console/Application.php index b00bf2a5b77..0995effa803 100644 --- a/src/Console/Application.php +++ b/src/Console/Application.php @@ -34,7 +34,7 @@ */ final class Application extends BaseApplication { - const VERSION = '2.18.4'; + const VERSION = '2.18.5-DEV'; const VERSION_CODENAME = 'Remote Void'; /**