diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentsAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentsAnalyzer.php index 461c13d9394..0b8e84cdd09 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentsAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentsAnalyzer.php @@ -1291,6 +1291,7 @@ private static function evaluateArbitraryParam( || $arg->value instanceof PhpParser\Node\Expr\FuncCall || $arg->value instanceof PhpParser\Node\Expr\MethodCall || $arg->value instanceof PhpParser\Node\Expr\StaticCall + || $arg->value instanceof PhpParser\Node\Expr\ArrowFunction || $arg->value instanceof PhpParser\Node\Expr\New_ || $arg->value instanceof PhpParser\Node\Expr\Cast || $arg->value instanceof PhpParser\Node\Expr\Assign diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallAnalyzer.php index 08956e319c8..e27d392ada3 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallAnalyzer.php @@ -528,49 +528,58 @@ private static function handleNamedFunction( $args = $stmt->isFirstClassCallable() ? [] : $stmt->getArgs(); if ($function_call_info->function_exists) { - if ($codebase->functions->params_provider->has($function_call_info->function_id)) { - $function_call_info->function_params = $codebase->functions->params_provider->getFunctionParams( - $statements_analyzer, - $function_call_info->function_id, - $args, - null, - $code_location - ); - } - if ($function_call_info->function_params === null) { - if (!$function_call_info->in_call_map || $function_call_info->is_stubbed) { - try { - $function_call_info->function_storage = $function_storage = $codebase_functions->getStorage( - $statements_analyzer, - strtolower($function_call_info->function_id) - ); - $function_call_info->function_params = $function_call_info->function_storage->params; + if (!$function_call_info->in_call_map || $function_call_info->is_stubbed) { + try { + $function_call_info->function_storage = $function_storage = $codebase_functions->getStorage( + $statements_analyzer, + strtolower($function_call_info->function_id) + ); - if (!$function_storage->allow_named_arg_calls) { - $function_call_info->allow_named_args = false; - } + $function_call_info->function_params = $function_call_info->function_storage->params; - if (!$is_predefined) { - $function_call_info->defined_constants = $function_storage->defined_constants; - $function_call_info->global_variables = $function_storage->global_variables; - } - } catch (UnexpectedValueException $e) { - $function_call_info->function_params = [ - new FunctionLikeParameter('args', false, null, null, null, false, false, true) - ]; + if (!$function_storage->allow_named_arg_calls) { + $function_call_info->allow_named_args = false; } - } else { - $function_callable = InternalCallMapHandler::getCallableFromCallMapById( - $codebase, - $function_call_info->function_id, - $args, - $statements_analyzer->node_data - ); - $function_call_info->function_params = $function_callable->params; + if (!$is_predefined) { + $function_call_info->defined_constants = $function_storage->defined_constants; + $function_call_info->global_variables = $function_storage->global_variables; + } + } catch (UnexpectedValueException $e) { + $function_call_info->function_params = [ + new FunctionLikeParameter('args', false, null, null, null, false, false, true) + ]; } + } else { + $function_callable = InternalCallMapHandler::getCallableFromCallMapById( + $codebase, + $function_call_info->function_id, + $args, + $statements_analyzer->node_data + ); + + $function_call_info->function_params = $function_callable->params; + } + + if ($codebase->functions->params_provider->has($function_call_info->function_id)) { + ArgumentsAnalyzer::analyze( + $statements_analyzer, + $stmt->getArgs(), + $function_call_info->function_params, + $function_call_info->function_id, + $function_call_info->allow_named_args, + $context + ); + + $function_call_info->function_params = $codebase->functions->params_provider->getFunctionParams( + $statements_analyzer, + $function_call_info->function_id, + $args, + $context, + $code_location + ); } if ($codebase->store_node_types