Skip to content

Commit

Permalink
bug PHP-CS-Fixer#5012 StrictParamFixer - must run before NativeFuncti…
Browse files Browse the repository at this point in the history
…onInvocationFixer (kubawerlos)

This PR was merged into the 2.15 branch.

Discussion
----------

StrictParamFixer - must run before NativeFunctionInvocationFixer

Commits
-------

5bec12d StrictParamFixer - must run before NativeFunctionInvocationFixer
  • Loading branch information
keradus committed Jun 27, 2020
2 parents cde6216 + 5bec12d commit e32ab4e
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Fixer/FunctionNotation/NativeFunctionInvocationFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,16 @@ public function isRisky()
return true;
}

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

/**
* {@inheritdoc}
*/
Expand Down
10 changes: 10 additions & 0 deletions src/Fixer/Strict/StrictParamFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@ public function isRisky()
return true;
}

/**
* {@inheritdoc}
*
* Must run before NativeFunctionInvocationFixer.
*/
public function getPriority()
{
return 1;
}

/**
* {@inheritdoc}
*/
Expand Down
1 change: 1 addition & 0 deletions tests/AutoReview/FixerFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ public function provideFixersPriorityCases()
[$fixers['standardize_increment'], $fixers['increment_style']],
[$fixers['standardize_not_equals'], $fixers['binary_operator_spaces']],
[$fixers['strict_comparison'], $fixers['binary_operator_spaces']],
[$fixers['strict_param'], $fixers['native_function_invocation']],
[$fixers['unary_operator_spaces'], $fixers['not_operator_with_space']],
[$fixers['unary_operator_spaces'], $fixers['not_operator_with_successor_space']],
[$fixers['void_return'], $fixers['phpdoc_no_empty_return']],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--TEST--
Integration of fixers: strict_param,native_function_invocation.
--RULESET--
{"strict_param": true, "native_function_invocation": true}
--EXPECT--
<?php

function isUtf8($content)
{
return \mb_detect_encoding($content, \mb_detect_order(), true);
}

--INPUT--
<?php

function isUtf8($content)
{
return \mb_detect_encoding($content);
}

0 comments on commit e32ab4e

Please sign in to comment.