diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentAnalyzer.php index 19a075ffe..f566002c4 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentAnalyzer.php @@ -491,6 +491,8 @@ class ArgumentAnalyzer && isset($unpacked_atomic_array->properties[$unpacked_argument_offset]) ) { $arg_value_type = $unpacked_atomic_array->properties[$unpacked_argument_offset]; + } elseif ($unpacked_atomic_array->fallback_params) { + $arg_value_type = $unpacked_atomic_array->getGenericValueType(); } elseif ($function_param->is_optional && $function_param->default_type) { if ($function_param->default_type instanceof Union) { $arg_value_type = $function_param->default_type; diff --git a/tests/Template/ClassTemplateTest.php b/tests/Template/ClassTemplateTest.php index a99c5d46f..677c078ba 100644 --- a/tests/Template/ClassTemplateTest.php +++ b/tests/Template/ClassTemplateTest.php @@ -4564,7 +4564,7 @@ class ClassTemplateTest extends TestCase $m = new Map(fn(int $num) => (string) $num); $m(["a"]);', - 'error_message' => 'InvalidScalarArgument', + 'error_message' => 'InvalidArgument', 'ignored_issues' => [], 'php_version' => '8.0' ],