Skip to content

Commit

Permalink
Autoreview the PHPDoc of *Fixer::getPriority based on the priority map
Browse files Browse the repository at this point in the history
  • Loading branch information
SpacePossum committed Jan 28, 2020
1 parent 10642ed commit 88d5f5f
Show file tree
Hide file tree
Showing 130 changed files with 754 additions and 103 deletions.
3 changes: 2 additions & 1 deletion src/Fixer/Alias/BacktickToShellExecFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,11 @@ public function getDefinition()

/**
* {@inheritdoc}
*
* Must run before EscapeImplicitBackslashesFixer, ExplicitStringVariableFixer.
*/
public function getPriority()
{
// Should run before escape_implicit_backslashes
return 2;
}

Expand Down
10 changes: 10 additions & 0 deletions src/Fixer/Alias/NoAliasFunctionsFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,16 @@ public function getDefinition()
);
}

/**
* {@inheritdoc}
*
* Must run before ImplodeCallFixer, PhpUnitDedicateAssertFixer.
*/
public function getPriority()
{
return 0;
}

/**
* {@inheritdoc}
*/
Expand Down
3 changes: 2 additions & 1 deletion src/Fixer/Alias/NoMixedEchoPrintFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,11 @@ public function getDefinition()

/**
* {@inheritdoc}
*
* Must run after NoShortEchoTagFixer.
*/
public function getPriority()
{
// should run after NoShortEchoTagFixer.
return -10;
}

Expand Down
3 changes: 2 additions & 1 deletion src/Fixer/Alias/PowToExponentiationFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,11 @@ public function getDefinition()

/**
* {@inheritdoc}
*
* Must run before BinaryOperatorSpacesFixer, MethodArgumentSpaceFixer, NativeFunctionCasingFixer, NoSpacesAfterFunctionNameFixer, NoSpacesInsideParenthesisFixer.
*/
public function getPriority()
{
// must be run before BinaryOperatorSpacesFixer
return 3;
}

Expand Down
3 changes: 2 additions & 1 deletion src/Fixer/ArrayNotation/ArraySyntaxFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,11 @@ public function getDefinition()

/**
* {@inheritdoc}
*
* Must run before BinaryOperatorSpacesFixer, TernaryOperatorSpacesFixer.
*/
public function getPriority()
{
// should be run before the BinaryOperatorSpacesFixer and TernaryOperatorSpacesFixer.
return 1;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,11 @@ public function getDefinition()

/**
* {@inheritdoc}
*
* Must run before BinaryOperatorSpacesFixer, TrailingCommaInMultilineArrayFixer.
*/
public function getPriority()
{
// should be run before the TrailingCommaInMultilineArrayFixer and BinaryOperatorSpacesFixer.
return 1;
}

Expand Down
10 changes: 10 additions & 0 deletions src/Fixer/ArrayNotation/TrailingCommaInMultilineArrayFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,16 @@ public function getDefinition()
);
}

/**
* {@inheritdoc}
*
* Must run after NoMultilineWhitespaceAroundDoubleArrowFixer.
*/
public function getPriority()
{
return 0;
}

/**
* {@inheritdoc}
*/
Expand Down
4 changes: 3 additions & 1 deletion src/Fixer/Basic/BracesFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,12 @@ public function bar($baz)

/**
* {@inheritdoc}
*
* Must run before ArrayIndentationFixer, MethodChainingIndentationFixer.
* Must run after ClassAttributesSeparationFixer, ElseifFixer, LineEndingFixer, MethodSeparationFixer, NoAlternativeSyntaxFixer, NoEmptyStatementFixer, NoUselessElseFixer, SingleTraitInsertPerStatementFixer.
*/
public function getPriority()
{
// should be run after the ElseIfFixer, LineEndingFixer, NoEmptyStatementFixer and NoUselessElseFixer
return -25;
}

Expand Down
10 changes: 10 additions & 0 deletions src/Fixer/Casing/NativeFunctionCasingFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ public function getDefinition()
);
}

/**
* {@inheritdoc}
*
* Must run after FunctionToConstantFixer, PowToExponentiationFixer.
*/
public function getPriority()
{
return 0;
}

/**
* {@inheritdoc}
*/
Expand Down
3 changes: 2 additions & 1 deletion src/Fixer/CastNotation/CastSpacesFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,11 @@ public function getDefinition()

/**
* {@inheritdoc}
*
* Must run after NoShortBoolCastFixer.
*/
public function getPriority()
{
// should be run after the NoShortBoolCastFixer
return -10;
}

Expand Down
3 changes: 2 additions & 1 deletion src/Fixer/CastNotation/NoShortBoolCastFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ final class NoShortBoolCastFixer extends AbstractFixer
{
/**
* {@inheritdoc}
*
* Must run before CastSpacesFixer.
*/
public function getPriority()
{
// should be run before the CastSpacesFixer
return -9;
}

Expand Down
5 changes: 3 additions & 2 deletions src/Fixer/ClassNotation/ClassAttributesSeparationFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,12 @@ class Sample

/**
* {@inheritdoc}
*
* Must run before BracesFixer, IndentationTypeFixer.
* Must run after OrderedClassElementsFixer.
*/
public function getPriority()
{
// Must run before BracesFixer and IndentationTypeFixer fixers because this fixer
// might add line breaks to the code without indenting.
return 55;
}

Expand Down
10 changes: 10 additions & 0 deletions src/Fixer/ClassNotation/FinalInternalClassFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,16 @@ public function getDefinition()
);
}

/**
* {@inheritdoc}
*
* Must run after PhpUnitInternalClassFixer.
*/
public function getPriority()
{
return 0;
}

/**
* {@inheritdoc}
*/
Expand Down
11 changes: 11 additions & 0 deletions src/Fixer/ClassNotation/MethodSeparationFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,17 @@ protected function bar()
);
}

/**
* {@inheritdoc}
*
* Must run before BracesFixer, IndentationTypeFixer.
* Must run after OrderedClassElementsFixer.
*/
public function getPriority()
{
return parent::getPriority();
}

/**
* Returns names of fixers to use instead, if any.
*
Expand Down
10 changes: 10 additions & 0 deletions src/Fixer/ClassNotation/NoBlankLinesAfterClassOpeningFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@ protected function foo()
);
}

/**
* {@inheritdoc}
*
* Must run after OrderedClassElementsFixer.
*/
public function getPriority()
{
return 0;
}

/**
* {@inheritdoc}
*/
Expand Down
3 changes: 2 additions & 1 deletion src/Fixer/ClassNotation/NoPhp4ConstructorFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,11 @@ public function Foo($bar)

/**
* {@inheritdoc}
*
* Must run before OrderedClassElementsFixer.
*/
public function getPriority()
{
// must run before OrderedClassElementsFixer
return 75;
}

Expand Down
5 changes: 3 additions & 2 deletions src/Fixer/ClassNotation/OrderedClassElementsFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,12 @@ public function C(){}

/**
* {@inheritdoc}
*
* Must run before ClassAttributesSeparationFixer, MethodSeparationFixer, NoBlankLinesAfterClassOpeningFixer, SpaceAfterSemicolonFixer.
* Must run after NoPhp4ConstructorFixer, ProtectedToPrivateFixer.
*/
public function getPriority()
{
// must run before MethodSeparationFixer, NoBlankLinesAfterClassOpeningFixer and SpaceAfterSemicolonFixer.
// must run after ProtectedToPrivateFixer.
return 65;
}

Expand Down
6 changes: 5 additions & 1 deletion src/Fixer/ClassNotation/ProtectedToPrivateFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,13 @@ protected function test()
);
}

/**
* {@inheritdoc}
*
* Must run before OrderedClassElementsFixer.
*/
public function getPriority()
{
// must run before OrderedClassElementsFixer.
return 66;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,13 @@ final class Example
);
}

/**
* {@inheritdoc}
*
* Must run before BracesFixer, SpaceAfterSemicolonFixer.
*/
public function getPriority()
{
// must be run before Braces and SpaceAfterSemicolonFixer
return 1;
}

Expand Down
2 changes: 2 additions & 0 deletions src/Fixer/Comment/CommentToPhpdocFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ public function isRisky()

/**
* {@inheritdoc}
*
* Must run before GeneralPhpdocAnnotationRemoveFixer, NoBlankLinesAfterPhpdocFixer, NoEmptyPhpdocFixer, NoSuperfluousPhpdocTagsFixer, PhpdocAddMissingParamAnnotationFixer, PhpdocAlignFixer, PhpdocAlignFixer, PhpdocAnnotationWithoutDotFixer, PhpdocInlineTagFixer, PhpdocNoAccessFixer, PhpdocNoAliasTagFixer, PhpdocNoEmptyReturnFixer, PhpdocNoPackageFixer, PhpdocNoUselessInheritdocFixer, PhpdocOrderFixer, PhpdocReturnSelfReferenceFixer, PhpdocSeparationFixer, PhpdocSingleLineVarSpacingFixer, PhpdocSummaryFixer, PhpdocToCommentFixer, PhpdocToReturnTypeFixer, PhpdocTrimConsecutiveBlankLineSeparationFixer, PhpdocTrimFixer, PhpdocTypesOrderFixer, PhpdocVarAnnotationCorrectOrderFixer, PhpdocVarWithoutNameFixer.
*/
public function getPriority()
{
Expand Down
4 changes: 2 additions & 2 deletions src/Fixer/Comment/HeaderCommentFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@ public function isCandidate(Tokens $tokens)

/**
* {@inheritdoc}
*
* Must run after NoBlankLinesAfterPhpdocFixer.
*/
public function getPriority()
{
// should be run after the NoBlankLinesAfterPhpdocFixer.
//
// When this fixer is configured with ["separate" => "bottom", "commentType" => "PHPDoc"]
// and the target file has no namespace or declare() construct,
// the fixed header comment gets trimmed by NoBlankLinesAfterPhpdocFixer if we run before it.
Expand Down
4 changes: 3 additions & 1 deletion src/Fixer/Comment/NoEmptyCommentFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ final class NoEmptyCommentFixer extends AbstractFixer

/**
* {@inheritdoc}
*
* Must run before NoExtraBlankLinesFixer, NoTrailingWhitespaceFixer, NoWhitespaceInBlankLineFixer.
* Must run after PhpdocToCommentFixer.
*/
public function getPriority()
{
// should be run after PhpdocToCommentFixer and before NoExtraBlankLinesFixer, NoTrailingWhitespaceFixer and NoWhitespaceInBlankLineFixer.
return 2;
}

Expand Down
10 changes: 10 additions & 0 deletions src/Fixer/Comment/NoTrailingWhitespaceInCommentFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ public function getDefinition()
);
}

/**
* {@inheritdoc}
*
* Must run after PhpdocNoUselessInheritdocFixer.
*/
public function getPriority()
{
return 0;
}

/**
* {@inheritdoc}
*/
Expand Down
11 changes: 11 additions & 0 deletions src/Fixer/ControlStructure/ElseifFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,17 @@ public function getDefinition()
);
}

/**
* {@inheritdoc}
*
* Must run before BracesFixer.
* Must run after NoAlternativeSyntaxFixer.
*/
public function getPriority()
{
return 0;
}

/**
* {@inheritdoc}
*/
Expand Down
3 changes: 2 additions & 1 deletion src/Fixer/ControlStructure/NoAlternativeSyntaxFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,11 @@ public function isCandidate(Tokens $tokens)

/**
* {@inheritdoc}
*
* Must run before BracesFixer, ElseifFixer, NoSuperfluousElseifFixer, NoUselessElseFixer.
*/
public function getPriority()
{
// Should run before BracesFixer and ElseifFixer
return 26;
}

Expand Down
10 changes: 10 additions & 0 deletions src/Fixer/ControlStructure/NoSuperfluousElseifFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ public function getDefinition()
);
}

/**
* {@inheritdoc}
*
* Must run after NoAlternativeSyntaxFixer.
*/
public function getPriority()
{
parent::getPriority();
}

/**
* {@inheritdoc}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ public function getDefinition()
}

/**
* Should be run before no_trailing_whitespace.
*
* {@inheritdoc}
*
* Must run before NoTrailingWhitespaceFixer.
*/
public function getPriority()
{
Expand Down
Loading

0 comments on commit 88d5f5f

Please sign in to comment.