Skip to content

Commit

Permalink
StrictParamFixer - must run before NativeFunctionInvocationFixer
Browse files Browse the repository at this point in the history
  • Loading branch information
kubawerlos committed Jun 15, 2020
1 parent c0d6a34 commit 5bec12d
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 @@ -235,6 +235,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 5bec12d

Please sign in to comment.