diff --git a/src/Rules/NarrowPrivateClassMethodParamTypeRule.php b/src/Rules/NarrowPrivateClassMethodParamTypeRule.php index 4c8d82e6..f81cacc2 100644 --- a/src/Rules/NarrowPrivateClassMethodParamTypeRule.php +++ b/src/Rules/NarrowPrivateClassMethodParamTypeRule.php @@ -110,6 +110,10 @@ private function validateArgVsParamTypes(array $args, MethodCall $methodCall, Sc continue; } + if ($param->variadic) { + return []; + } + $paramRuleError = $this->validateParam($param, $position, $arg->value, $scope); if (! $paramRuleError instanceof RuleError) { continue; diff --git a/tests/Rules/NarrowPrivateClassMethodParamTypeRule/Fixture/SkipVariadics.php b/tests/Rules/NarrowPrivateClassMethodParamTypeRule/Fixture/SkipVariadics.php new file mode 100644 index 00000000..db8c922b --- /dev/null +++ b/tests/Rules/NarrowPrivateClassMethodParamTypeRule/Fixture/SkipVariadics.php @@ -0,0 +1,21 @@ +takesVariadic(...$arr); + } + + private function takesVariadic(Node ...$node) + { + + } +} diff --git a/tests/Rules/NarrowPrivateClassMethodParamTypeRule/NarrowPrivateClassMethodParamTypeRuleTest.php b/tests/Rules/NarrowPrivateClassMethodParamTypeRule/NarrowPrivateClassMethodParamTypeRuleTest.php index 1005cc1d..84483443 100644 --- a/tests/Rules/NarrowPrivateClassMethodParamTypeRule/NarrowPrivateClassMethodParamTypeRuleTest.php +++ b/tests/Rules/NarrowPrivateClassMethodParamTypeRule/NarrowPrivateClassMethodParamTypeRuleTest.php @@ -50,6 +50,7 @@ public static function provideData(): Iterator yield [__DIR__ . '/Fixture/DoubleShot.php', [[$argErrorMessage, 15], [$paramErrorMessage, 15]]]; yield [__DIR__ . '/Fixture/SkipGenericType.php', []]; yield [__DIR__ . '/Fixture/SkipAbstractBase.php', []]; + yield [__DIR__ . '/Fixture/SkipVariadics.php', []]; } /**