Skip to content

Commit

Permalink
Fix priority between PHPDoc return type fixers
Browse files Browse the repository at this point in the history
  • Loading branch information
julienfalque committed Jun 21, 2018
1 parent 0df921d commit 1364398
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Fixer/FunctionNotation/PhpdocToReturnTypeFixer.php
Expand Up @@ -128,8 +128,8 @@ public function isCandidate(Tokens $tokens)
public function getPriority()
{
// should be run after PhpdocScalarFixer.
// should be run before ReturnTypeDeclarationFixer, FullyQualifiedStrictTypesFixer.
return 1;
// should be run before ReturnTypeDeclarationFixer, FullyQualifiedStrictTypesFixer, NoSuperfluousPhpdocTagsFixer.
return 8;
}

/**
Expand Down
1 change: 1 addition & 0 deletions tests/AutoReview/FixerFactoryTest.php
Expand Up @@ -183,6 +183,7 @@ public function provideFixersPriorityCases()
[$fixers['phpdoc_to_comment'], $fixers['no_empty_comment']],
[$fixers['phpdoc_to_comment'], $fixers['phpdoc_no_useless_inheritdoc']],
[$fixers['phpdoc_to_return_type'], $fixers['fully_qualified_strict_types']],
[$fixers['phpdoc_to_return_type'], $fixers['no_superfluous_phpdoc_tags']],
[$fixers['phpdoc_to_return_type'], $fixers['return_type_declaration']],
[$fixers['phpdoc_var_without_name'], $fixers['phpdoc_trim']],
[$fixers['pow_to_exponentiation'], $fixers['binary_operator_spaces']],
Expand Down
@@ -0,0 +1,26 @@
--TEST--
Integration of fixers: phpdoc_to_return_type,no_superfluous_phpdoc_tags.
--RULESET--
{"phpdoc_to_return_type": true, "no_superfluous_phpdoc_tags": true}
--REQUIREMENTS--
{"php": 70100}
--EXPECT--
<?php

class Test {
/**
*/
public function foo(): int {
}
}

--INPUT--
<?php

class Test {
/**
* @return int
*/
public function foo() {
}
}

0 comments on commit 1364398

Please sign in to comment.