mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +01:00
Check context var exists
This commit is contained in:
parent
88fe805c27
commit
2dc86651a4
@ -197,7 +197,12 @@ class SwitchAnalyzer
|
||||
$stmt->allMatched = true;
|
||||
} elseif ($switch_scope->possibly_redefined_vars) {
|
||||
foreach ($switch_scope->possibly_redefined_vars as $var_id => $type) {
|
||||
$context->vars_in_scope[$var_id] = Type::combineUnionTypes($type, $context->vars_in_scope[$var_id]);
|
||||
if (isset($context->vars_in_scope[$var_id])) {
|
||||
$context->vars_in_scope[$var_id] = Type::combineUnionTypes(
|
||||
$type,
|
||||
$context->vars_in_scope[$var_id]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user