From 5bec12d25bb9f684f5898bb0eb8395d738a3773c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Wer=C5=82os?= Date: Mon, 15 Jun 2020 17:50:57 +0200 Subject: [PATCH] StrictParamFixer - must run before NativeFunctionInvocationFixer --- .../NativeFunctionInvocationFixer.php | 10 ++++++++++ src/Fixer/Strict/StrictParamFixer.php | 10 ++++++++++ tests/AutoReview/FixerFactoryTest.php | 1 + ...rict_param,native_function_invocation.test | 19 +++++++++++++++++++ 4 files changed, 40 insertions(+) create mode 100644 tests/Fixtures/Integration/priority/strict_param,native_function_invocation.test diff --git a/src/Fixer/FunctionNotation/NativeFunctionInvocationFixer.php b/src/Fixer/FunctionNotation/NativeFunctionInvocationFixer.php index 26bf5416152..285de8130f4 100644 --- a/src/Fixer/FunctionNotation/NativeFunctionInvocationFixer.php +++ b/src/Fixer/FunctionNotation/NativeFunctionInvocationFixer.php @@ -176,6 +176,16 @@ public function isRisky() return true; } + /** + * {@inheritdoc} + * + * Must run after StrictParamFixer. + */ + public function getPriority() + { + return 0; + } + /** * {@inheritdoc} */ diff --git a/src/Fixer/Strict/StrictParamFixer.php b/src/Fixer/Strict/StrictParamFixer.php index b8c5c17b9fd..4e1834aa803 100644 --- a/src/Fixer/Strict/StrictParamFixer.php +++ b/src/Fixer/Strict/StrictParamFixer.php @@ -53,6 +53,16 @@ public function isRisky() return true; } + /** + * {@inheritdoc} + * + * Must run before NativeFunctionInvocationFixer. + */ + public function getPriority() + { + return 1; + } + /** * {@inheritdoc} */ diff --git a/tests/AutoReview/FixerFactoryTest.php b/tests/AutoReview/FixerFactoryTest.php index 894d19729df..679a714fab0 100644 --- a/tests/AutoReview/FixerFactoryTest.php +++ b/tests/AutoReview/FixerFactoryTest.php @@ -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']], diff --git a/tests/Fixtures/Integration/priority/strict_param,native_function_invocation.test b/tests/Fixtures/Integration/priority/strict_param,native_function_invocation.test new file mode 100644 index 00000000000..325fc228246 --- /dev/null +++ b/tests/Fixtures/Integration/priority/strict_param,native_function_invocation.test @@ -0,0 +1,19 @@ +--TEST-- +Integration of fixers: strict_param,native_function_invocation. +--RULESET-- +{"strict_param": true, "native_function_invocation": true} +--EXPECT-- +