Skip to content

Commit

Permalink
bug #3835 Fix priority between PHPDoc return type fixers (julienfalqu…
Browse files Browse the repository at this point in the history
…e, keradus)

This PR was merged into the 2.12 branch.

Discussion
----------

Fix priority between PHPDoc return type fixers

Commits
-------

082ed03 Update composer.json
431f6c6 Fix priority between PHPDoc return type fixers
  • Loading branch information
SpacePossum committed Jul 4, 2018
2 parents 012b1e2 + 082ed03 commit a008ddb
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 3 deletions.
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -44,7 +44,7 @@
"php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.0.1",
"php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.0.1",
"phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1",
"phpunitgoodpractices/traits": "^1.5",
"phpunitgoodpractices/traits": "^1.5.1",
"symfony/phpunit-bridge": "^4.0"
},
"suggest": {
Expand Down
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['pow_to_exponentiation'], $fixers['binary_operator_spaces']],
[$fixers['pow_to_exponentiation'], $fixers['method_argument_space']],
Expand Down
@@ -0,0 +1,28 @@
--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": 70000}
--EXPECT--
<?php

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

--INPUT--
<?php

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

0 comments on commit a008ddb

Please sign in to comment.