mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +01:00
Prevent variadic args disrupting required closure param count
This commit is contained in:
parent
9404de699d
commit
49820b06dd
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -269,6 +269,15 @@ class CallableTest extends TestCase
|
||||
|
||||
callMeMaybe("foo");',
|
||||
],
|
||||
'arrayMapVariadicClosureArg' => [
|
||||
'<?php
|
||||
$a = array_map(
|
||||
function(int $type, string ...$args):string {
|
||||
return "hello";
|
||||
},
|
||||
[1, 2, 3]
|
||||
);',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user