diff --git a/src/Psalm/Checker/Statements/Expression/CallChecker.php b/src/Psalm/Checker/Statements/Expression/CallChecker.php index 1b938b22c..5ee5ffacb 100644 --- a/src/Psalm/Checker/Statements/Expression/CallChecker.php +++ b/src/Psalm/Checker/Statements/Expression/CallChecker.php @@ -1045,7 +1045,7 @@ class CallChecker $required_param_count = 0; foreach ($closure_params as $i => $param) { - if (!$param->is_optional) { + if (!$param->is_optional && !$param->is_variadic) { $required_param_count = $i + 1; } } diff --git a/tests/CallableTest.php b/tests/CallableTest.php index 4d3966b23..427af3514 100644 --- a/tests/CallableTest.php +++ b/tests/CallableTest.php @@ -269,6 +269,15 @@ class CallableTest extends TestCase callMeMaybe("foo");', ], + 'arrayMapVariadicClosureArg' => [ + '