diff --git a/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php b/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php index ba8269dc4dc..d94725aaa6b 100644 --- a/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php @@ -1034,7 +1034,7 @@ private function processParams( $context->vars_in_scope['$' . $function_param->name]->by_ref = true; } - $parser_param = $this->function->getParams()[$offset]; + $parser_param = $this->function->getParams()[$offset] ?? null; if ($function_param->location) { $statements_analyzer->registerVariable( @@ -1045,7 +1045,7 @@ private function processParams( } if (!$function_param->type_location || !$function_param->location) { - if ($parser_param->default) { + if ($parser_param && $parser_param->default) { ExpressionAnalyzer::analyze($statements_analyzer, $parser_param->default, $context); } @@ -1098,7 +1098,7 @@ private function processParams( } } - if ($parser_param->default) { + if ($parser_param && $parser_param->default) { ExpressionAnalyzer::analyze($statements_analyzer, $parser_param->default, $context); $default_type = $statements_analyzer->node_data->getType($parser_param->default);