Skip to content

Commit

Permalink
minor #5386 DX: remove incorrect priority relations (kubawerlos)
Browse files Browse the repository at this point in the history
This PR was merged into the 2.17 branch.

Discussion
----------

DX: remove incorrect priority relations

Fixer `phpdoc_order` has no priority relation to `phpdoc_no_access` or `phpdoc_no_package` - it does not matter if the tags are sorted or removed first.

Commits
-------

23c6964 DX: remove incorrect priority relations
  • Loading branch information
keradus committed Dec 24, 2020
2 parents 29ec23d + 23c6964 commit 9d14829
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/Fixer/Phpdoc/PhpdocNoAccessFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class Foo
/**
* {@inheritdoc}
*
* Must run before NoEmptyPhpdocFixer, PhpdocAlignFixer, PhpdocOrderFixer, PhpdocSeparationFixer, PhpdocTrimFixer.
* Must run before NoEmptyPhpdocFixer, PhpdocAlignFixer, PhpdocSeparationFixer, PhpdocTrimFixer.
* Must run after CommentToPhpdocFixer, PhpdocIndentFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer.
*/
public function getPriority()
Expand Down
2 changes: 1 addition & 1 deletion src/Fixer/Phpdoc/PhpdocNoPackageFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class Baz
/**
* {@inheritdoc}
*
* Must run before NoEmptyPhpdocFixer, PhpdocAlignFixer, PhpdocOrderFixer, PhpdocSeparationFixer, PhpdocTrimFixer.
* Must run before NoEmptyPhpdocFixer, PhpdocAlignFixer, PhpdocSeparationFixer, PhpdocTrimFixer.
* Must run after CommentToPhpdocFixer, PhpdocIndentFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer.
*/
public function getPriority()
Expand Down
2 changes: 1 addition & 1 deletion src/Fixer/Phpdoc/PhpdocOrderFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function getDefinition()
* {@inheritdoc}
*
* Must run before PhpdocAlignFixer, PhpdocSeparationFixer, PhpdocTrimFixer.
* Must run after CommentToPhpdocFixer, PhpdocAddMissingParamAnnotationFixer, PhpdocIndentFixer, PhpdocNoAccessFixer, PhpdocNoEmptyReturnFixer, PhpdocNoPackageFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer.
* Must run after CommentToPhpdocFixer, PhpdocAddMissingParamAnnotationFixer, PhpdocIndentFixer, PhpdocNoEmptyReturnFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer.
*/
public function getPriority()
{
Expand Down
14 changes: 0 additions & 14 deletions tests/AutoReview/FixerFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ public function provideFixersPriorityCases()
[$fixers['phpdoc_annotation_without_dot'], $fixers['phpdoc_types']],
[$fixers['phpdoc_annotation_without_dot'], $fixers['phpdoc_types_order']],
[$fixers['phpdoc_no_access'], $fixers['no_empty_phpdoc']],
[$fixers['phpdoc_no_access'], $fixers['phpdoc_order']],
[$fixers['phpdoc_no_access'], $fixers['phpdoc_separation']],
[$fixers['phpdoc_no_access'], $fixers['phpdoc_trim']],
[$fixers['phpdoc_no_alias_tag'], $fixers['phpdoc_add_missing_param_annotation']],
Expand All @@ -232,7 +231,6 @@ public function provideFixersPriorityCases()
[$fixers['phpdoc_no_empty_return'], $fixers['phpdoc_separation']],
[$fixers['phpdoc_no_empty_return'], $fixers['phpdoc_trim']],
[$fixers['phpdoc_no_package'], $fixers['no_empty_phpdoc']],
[$fixers['phpdoc_no_package'], $fixers['phpdoc_order']],
[$fixers['phpdoc_no_package'], $fixers['phpdoc_separation']],
[$fixers['phpdoc_no_package'], $fixers['phpdoc_trim']],
[$fixers['phpdoc_no_useless_inheritdoc'], $fixers['no_empty_phpdoc']],
Expand Down Expand Up @@ -339,13 +337,6 @@ static function ($name) {
*/
public function testFixersPriorityPairsHaveIntegrationTest(FixerInterface $first, FixerInterface $second)
{
// This structure contains older cases that are not yet covered by tests.
// It may only shrink, never add anything to it.
$casesWithoutTests = [
'phpdoc_no_access,phpdoc_order.test',
'phpdoc_no_package,phpdoc_order.test',
];

$integrationTestName = $this->generateIntegrationTestName($first, $second);
$file = $this->getIntegrationPriorityDirectory().$integrationTestName;

Expand All @@ -358,11 +349,6 @@ public function testFixersPriorityPairsHaveIntegrationTest(FixerInterface $first
$integrationTestExists = is_file($file);
}

if (\in_array($integrationTestName, $casesWithoutTests, true)) {
static::assertFalse($integrationTestExists, sprintf('Case "%s" already has an integration test, so it should be removed from "$casesWithoutTests".', $integrationTestName));
static::markTestIncomplete(sprintf('Case "%s" has no integration test yet, please help and add it.', $integrationTestName));
}

static::assertTrue($integrationTestExists, sprintf('There shall be an integration test "%s". How do you know that priority set up is good, if there is no integration test to check it?', $integrationTestName));

$file = realpath($file);
Expand Down

0 comments on commit 9d14829

Please sign in to comment.