mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +01:00
parent
09abcfb650
commit
0fe3e1f83b
@ -661,7 +661,7 @@ class ArgumentsAnalyzer
|
||||
}
|
||||
} elseif ($arg->name && $function_storage && $function_storage->allow_named_arg_calls) {
|
||||
foreach ($function_params as $candidate_param) {
|
||||
if ($candidate_param->name === $arg->name->name) {
|
||||
if ($candidate_param->name === $arg->name->name || $candidate_param->is_variadic) {
|
||||
$arg_function_params = [$candidate_param];
|
||||
break;
|
||||
}
|
||||
|
@ -259,6 +259,15 @@ class ArgTest extends TestCase
|
||||
[],
|
||||
'8.0'
|
||||
],
|
||||
'useNamedVariadicArguments' => [
|
||||
'<?php
|
||||
function takesArguments(int ...$args) : void {}
|
||||
|
||||
takesArguments(age: 5);',
|
||||
[],
|
||||
[],
|
||||
'8.0'
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
@ -432,6 +441,16 @@ class ArgTest extends TestCase
|
||||
false,
|
||||
'8.0'
|
||||
],
|
||||
'wrongTypeVariadicArguments' => [
|
||||
'<?php
|
||||
function takesArguments(int ...$args) : void {}
|
||||
|
||||
takesArguments(age: "abc");',
|
||||
'error_message' => 'InvalidScalarArgument',
|
||||
[],
|
||||
false,
|
||||
'8.0'
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user