1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 04:45:20 +01:00

Fix using std library functions

This commit is contained in:
Matt Brown 2021-01-27 22:28:33 -05:00
parent 7ce5b7ec13
commit 4807d38507
2 changed files with 8 additions and 1 deletions

View File

@ -628,7 +628,7 @@ class ArgumentsAnalyzer
for ($i = $argument_offset; $i < $function_param_count; $i++) { for ($i = $argument_offset; $i < $function_param_count; $i++) {
$arg_function_params[$argument_offset][] = $function_params[$i]; $arg_function_params[$argument_offset][] = $function_params[$i];
} }
} elseif ($arg->name && $function_storage && $function_storage->allow_named_arg_calls) { } elseif ($arg->name && (!$function_storage || $function_storage->allow_named_arg_calls)) {
foreach ($function_params as $candidate_param) { foreach ($function_params as $candidate_param) {
if ($candidate_param->name === $arg->name->name || $candidate_param->is_variadic) { if ($candidate_param->name === $arg->name->name || $candidate_param->is_variadic) {
$arg_function_params[$argument_offset] = [$candidate_param]; $arg_function_params[$argument_offset] = [$candidate_param];

View File

@ -273,6 +273,13 @@ class ArgTest extends TestCase
bar(...["aaaaa"]); bar(...["aaaaa"]);
function bar(string $p1, int $p3 = 10) : void {}' function bar(string $p1, int $p3 = 10) : void {}'
], ],
'mkdirNamedParameters' => [
'<?php declare(strict_types=1);
mkdir("/var/test/123", recursive: true);',
[],
[],
'8.0'
],
]; ];
} }