mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 20:34:47 +01:00
More graceful early exit if not checking variables
This commit is contained in:
parent
182f715b62
commit
8db6921f1c
@ -477,11 +477,18 @@ class ExpressionChecker
|
||||
}
|
||||
|
||||
if (!$context->check_variables) {
|
||||
$stmt->inferredType = Type::getMixed();
|
||||
if (is_string($stmt->name)) {
|
||||
$var_name = '$' . $stmt->name;
|
||||
|
||||
if (is_string($stmt->name) && !$context->hasVariable('$' . $stmt->name)) {
|
||||
$context->vars_in_scope['$' . $stmt->name] = Type::getMixed();
|
||||
$context->vars_possibly_in_scope['$' . $stmt->name] = true;
|
||||
if (!$context->hasVariable($var_name)) {
|
||||
$context->vars_in_scope[$var_name] = Type::getMixed();
|
||||
$context->vars_possibly_in_scope[$var_name] = true;
|
||||
$stmt->inferredType = Type::getMixed();
|
||||
} else {
|
||||
$stmt->inferredType = $context->vars_in_scope[$var_name];
|
||||
}
|
||||
} else {
|
||||
$stmt->inferredType = Type::getMixed();
|
||||
}
|
||||
|
||||
return null;
|
||||
|
Loading…
Reference in New Issue
Block a user