Skip to content

Commit cc0ebc1

Browse files
committed
Priority issues
1 parent 088428f commit cc0ebc1

31 files changed

+436
-51
lines changed

src/Console/Command/HelpCommand.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use PhpCsFixer\Console\Application;
1717
use PhpCsFixer\Fixer\ConfigurableFixerInterface;
1818
use PhpCsFixer\Fixer\ConfigurationDefinitionFixerInterface;
19-
use PhpCsFixer\Fixer\DefinedFixerInterface;
2019
use PhpCsFixer\Fixer\DeprecatedFixerInterface;
2120
use PhpCsFixer\Fixer\FixerInterface;
2221
use PhpCsFixer\FixerConfiguration\AliasedFixerOption;
@@ -473,11 +472,7 @@ static function (FixerInterface $a, FixerInterface $b) {
473472
foreach ($fixers as $i => $fixer) {
474473
$sets = $getSetsWithRule($fixer->getName());
475474

476-
if ($fixer instanceof DefinedFixerInterface) {
477-
$description = $fixer->getDefinition()->getSummary();
478-
} else {
479-
$description = '[n/a]';
480-
}
475+
$description = $fixer->getDefinition()->getSummary();
481476

482477
if ($fixer instanceof DeprecatedFixerInterface) {
483478
$successors = $fixer->getSuccessorsNames();

src/Fixer/ClassNotation/OrderedClassElementsFixer.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ final class OrderedClassElementsFixer extends AbstractFixer implements Configura
3030
{
3131
/** @internal */
3232
const SORT_ALPHA = 'alpha';
33+
3334
/** @internal */
3435
const SORT_NONE = 'none';
3536

@@ -345,8 +346,6 @@ private function getElements(Tokens $tokens, $startIndex)
345346
$elements[] = $element;
346347
$startIndex = $element['end'] + 1;
347348
}
348-
349-
return [];
350349
}
351350

352351
/**

src/Fixer/FunctionNotation/CombineNestedDirnameFixer.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,6 @@ public function getPriority()
7676
protected function applyFix(\SplFileInfo $file, Tokens $tokens)
7777
{
7878
for ($index = $tokens->count() - 1; 0 <= $index; --$index) {
79-
$token = $tokens[$index];
80-
81-
if (!$token->equals([T_STRING, 'dirname'], false)) {
82-
continue;
83-
}
84-
8579
$dirnameInfo = $this->getDirnameInfo($tokens, $index);
8680

8781
if (!$dirnameInfo) {

src/Fixer/PhpTag/NoClosingTagFixer.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,7 @@ public function isCandidate(Tokens $tokens)
4949
*/
5050
protected function applyFix(\SplFileInfo $file, Tokens $tokens)
5151
{
52-
if (\count($tokens) < 2 || !$tokens->isMonolithicPhp()) {
53-
return;
54-
}
55-
56-
if (!$tokens->isTokenKindFound(T_CLOSE_TAG)) {
52+
if (\count($tokens) < 2 || !$tokens->isMonolithicPhp() || !$tokens->isTokenKindFound(T_CLOSE_TAG)) {
5753
return;
5854
}
5955

src/Fixer/Phpdoc/PhpdocAnnotationWithoutDotFixer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ function foo ($bar) {}
4646
/**
4747
* {@inheritdoc}
4848
*
49-
* Must run before PhpdocAlignFixer.
50-
* Must run after CommentToPhpdocFixer, PhpdocIndentFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer.
49+
* Must run before PhpdocAlignFixer, PhpdocTypesFixer, PhpdocTypesOrderFixer.
50+
* Must run after CommentToPhpdocFixer, PhpdocIndentFixer, PhpdocToCommentFixer.
5151
*/
5252
public function getPriority()
5353
{
54-
return 0;
54+
return 17;
5555
}
5656

5757
/**

src/Fixer/Phpdoc/PhpdocScalarFixer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ function sample($a, $b, $c)
6565
/**
6666
* {@inheritdoc}
6767
*
68-
* Must run before GeneralPhpdocAnnotationRemoveFixer, NoBlankLinesAfterPhpdocFixer, NoEmptyPhpdocFixer, NoSuperfluousPhpdocTagsFixer, PhpdocAddMissingParamAnnotationFixer, PhpdocAlignFixer, PhpdocAlignFixer, PhpdocAnnotationWithoutDotFixer, PhpdocInlineTagFixer, PhpdocNoAccessFixer, PhpdocNoAliasTagFixer, PhpdocNoEmptyReturnFixer, PhpdocNoPackageFixer, PhpdocNoUselessInheritdocFixer, PhpdocOrderFixer, PhpdocReturnSelfReferenceFixer, PhpdocSeparationFixer, PhpdocSingleLineVarSpacingFixer, PhpdocSummaryFixer, PhpdocToReturnTypeFixer, PhpdocToReturnTypeFixer, PhpdocTrimConsecutiveBlankLineSeparationFixer, PhpdocTrimFixer, PhpdocTypesOrderFixer, PhpdocVarAnnotationCorrectOrderFixer, PhpdocVarWithoutNameFixer.
68+
* Must run before GeneralPhpdocAnnotationRemoveFixer, NoBlankLinesAfterPhpdocFixer, NoEmptyPhpdocFixer, NoSuperfluousPhpdocTagsFixer, PhpdocAddMissingParamAnnotationFixer, PhpdocAlignFixer, PhpdocAlignFixer, PhpdocInlineTagFixer, PhpdocNoAccessFixer, PhpdocNoAliasTagFixer, PhpdocNoEmptyReturnFixer, PhpdocNoPackageFixer, PhpdocNoUselessInheritdocFixer, PhpdocOrderFixer, PhpdocReturnSelfReferenceFixer, PhpdocSeparationFixer, PhpdocSingleLineVarSpacingFixer, PhpdocSummaryFixer, PhpdocToReturnTypeFixer, PhpdocToReturnTypeFixer, PhpdocTrimConsecutiveBlankLineSeparationFixer, PhpdocTrimFixer, PhpdocTypesOrderFixer, PhpdocVarAnnotationCorrectOrderFixer, PhpdocVarWithoutNameFixer.
6969
* Must run after PhpdocTypesFixer.
7070
*/
7171
public function getPriority()

src/Fixer/Phpdoc/PhpdocTypesFixer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ public function getDefinition()
105105
/**
106106
* {@inheritdoc}
107107
*
108-
* Must run before GeneralPhpdocAnnotationRemoveFixer, NoBlankLinesAfterPhpdocFixer, NoEmptyPhpdocFixer, NoSuperfluousPhpdocTagsFixer, PhpdocAddMissingParamAnnotationFixer, PhpdocAlignFixer, PhpdocAlignFixer, PhpdocAnnotationWithoutDotFixer, PhpdocInlineTagFixer, PhpdocNoAccessFixer, PhpdocNoAliasTagFixer, PhpdocNoEmptyReturnFixer, PhpdocNoPackageFixer, PhpdocNoUselessInheritdocFixer, PhpdocOrderFixer, PhpdocReturnSelfReferenceFixer, PhpdocScalarFixer, PhpdocSeparationFixer, PhpdocSingleLineVarSpacingFixer, PhpdocSummaryFixer, PhpdocToReturnTypeFixer, PhpdocToReturnTypeFixer, PhpdocTrimConsecutiveBlankLineSeparationFixer, PhpdocTrimFixer, PhpdocTypesOrderFixer, PhpdocVarAnnotationCorrectOrderFixer, PhpdocVarWithoutNameFixer.
109-
* Must run after PhpdocIndentFixer.
108+
* Must run before GeneralPhpdocAnnotationRemoveFixer, NoBlankLinesAfterPhpdocFixer, NoEmptyPhpdocFixer, NoSuperfluousPhpdocTagsFixer, PhpdocAddMissingParamAnnotationFixer, PhpdocAlignFixer, PhpdocAlignFixer, PhpdocInlineTagFixer, PhpdocNoAccessFixer, PhpdocNoAliasTagFixer, PhpdocNoEmptyReturnFixer, PhpdocNoPackageFixer, PhpdocNoUselessInheritdocFixer, PhpdocOrderFixer, PhpdocReturnSelfReferenceFixer, PhpdocScalarFixer, PhpdocSeparationFixer, PhpdocSingleLineVarSpacingFixer, PhpdocSummaryFixer, PhpdocToReturnTypeFixer, PhpdocToReturnTypeFixer, PhpdocTrimConsecutiveBlankLineSeparationFixer, PhpdocTrimFixer, PhpdocTypesOrderFixer, PhpdocVarAnnotationCorrectOrderFixer, PhpdocVarWithoutNameFixer.
109+
* Must run after PhpdocAnnotationWithoutDotFixer, PhpdocIndentFixer.
110110
*/
111111
public function getPriority()
112112
{

src/Fixer/Phpdoc/PhpdocTypesOrderFixer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function getDefinition()
8888
* {@inheritdoc}
8989
*
9090
* Must run before PhpdocAlignFixer.
91-
* Must run after CommentToPhpdocFixer, PhpdocIndentFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer.
91+
* Must run after CommentToPhpdocFixer, PhpdocAnnotationWithoutDotFixer, PhpdocIndentFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer.
9292
*/
9393
public function getPriority()
9494
{

src/Report/ReporterFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public static function create()
3232

3333
public function registerBuiltInReporters()
3434
{
35-
/** @var string[] $builtInReporters */
35+
/** @var null|string[] $builtInReporters */
3636
static $builtInReporters;
3737

3838
if (null === $builtInReporters) {

tests/AutoReview/FixerFactoryTest.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,8 @@ public function provideFixersPriorityCases()
185185
[$fixers['phpdoc_add_missing_param_annotation'], $fixers['no_superfluous_phpdoc_tags']],
186186
[$fixers['phpdoc_add_missing_param_annotation'], $fixers['phpdoc_align']],
187187
[$fixers['phpdoc_add_missing_param_annotation'], $fixers['phpdoc_order']],
188+
[$fixers['phpdoc_annotation_without_dot'], $fixers['phpdoc_types']],
189+
[$fixers['phpdoc_annotation_without_dot'], $fixers['phpdoc_types_order']],
188190
[$fixers['phpdoc_no_access'], $fixers['no_empty_phpdoc']],
189191
[$fixers['phpdoc_no_access'], $fixers['phpdoc_order']],
190192
[$fixers['phpdoc_no_access'], $fixers['phpdoc_separation']],
@@ -272,9 +274,12 @@ static function ($name) {
272274
if (!\in_array($docFixerName, ['comment_to_phpdoc', 'phpdoc_to_comment', 'phpdoc_indent', 'phpdoc_types', 'phpdoc_scalar'], true)) {
273275
$cases[] = [$fixers['comment_to_phpdoc'], $fixers[$docFixerName]];
274276
$cases[] = [$fixers['phpdoc_indent'], $fixers[$docFixerName]];
275-
$cases[] = [$fixers['phpdoc_scalar'], $fixers[$docFixerName]];
276277
$cases[] = [$fixers['phpdoc_to_comment'], $fixers[$docFixerName]];
277-
$cases[] = [$fixers['phpdoc_types'], $fixers[$docFixerName]];
278+
279+
if ('phpdoc_annotation_without_dot' !== $docFixerName) {
280+
$cases[] = [$fixers['phpdoc_scalar'], $fixers[$docFixerName]];
281+
$cases[] = [$fixers['phpdoc_types'], $fixers[$docFixerName]];
282+
}
278283
}
279284

280285
if ('phpdoc_align' !== $docFixerName) {

0 commit comments

Comments
 (0)