diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentsAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentsAnalyzer.php index 57fd1b733..4e0d86d0e 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentsAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentsAnalyzer.php @@ -628,7 +628,7 @@ class ArgumentsAnalyzer for ($i = $argument_offset; $i < $function_param_count; $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) { if ($candidate_param->name === $arg->name->name || $candidate_param->is_variadic) { $arg_function_params[$argument_offset] = [$candidate_param]; diff --git a/tests/ArgTest.php b/tests/ArgTest.php index 3682133bc..1b2613b70 100644 --- a/tests/ArgTest.php +++ b/tests/ArgTest.php @@ -273,6 +273,13 @@ class ArgTest extends TestCase bar(...["aaaaa"]); function bar(string $p1, int $p3 = 10) : void {}' ], + 'mkdirNamedParameters' => [ + '