diff --git a/rules-tests/Php71/Rector/FuncCall/RemoveExtraParametersRector/Fixture/skip_defer_function.php.inc b/rules-tests/Php71/Rector/FuncCall/RemoveExtraParametersRector/Fixture/skip_defer_function.php.inc new file mode 100644 index 00000000000..885174dbb8b --- /dev/null +++ b/rules-tests/Php71/Rector/FuncCall/RemoveExtraParametersRector/Fixture/skip_defer_function.php.inc @@ -0,0 +1,11 @@ +shouldSkipFunctionReflection($functionLikeReflection)) { + return null; + } + $numberOfArguments = count($node->getRawArgs()); if ($numberOfArguments <= $maximumAllowedParameterCount) { return null; @@ -99,6 +103,18 @@ public function refactor(Node $node): ?Node return $node; } + private function shouldSkipFunctionReflection(MethodReflection|FunctionReflection $reflection): bool + { + if ($reflection instanceof FunctionReflection) { + $fileName = (string) $reflection->getFileName(); + if (str_contains($fileName, 'phpstan.phar')) { + return true; + } + } + + return false; + } + private function shouldSkip(FuncCall | MethodCall | StaticCall $call): bool { if ($call->args === []) {