1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 12:24:49 +01:00

Fix using std library functions

This commit is contained in:
Matt Brown 2021-01-27 22:28:33 -05:00 committed by Daniil Gentili
parent 9e41905171
commit ebc8b613de
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
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'
],
]; ];
} }