1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-21 21:31:13 +01:00

Add null check

This commit is contained in:
Brown 2020-05-11 11:56:07 -04:00
parent 291018034b
commit 0d5d7c8938

View File

@ -1401,10 +1401,13 @@ class FunctionCallAnalyzer extends CallAnalyzer
}
}
}
} elseif (($function_id === 'min' || $function_id === 'max') && count($stmt->args) === 1) {
} elseif (($function_id === 'min' || $function_id === 'max')
&& count($stmt->args) === 1
&& $first_arg
) {
$first_arg_type = $statements_analyzer->node_data->getType($first_arg->value);
if ($first_arg_type->hasScalarType()) {
if ($first_arg_type && $first_arg_type->hasScalarType()) {
if (IssueBuffer::accepts(
new \Psalm\Issue\TooFewArguments(
$function_id . ' must have more than one argument unless an array is passed',