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

Make sure to union try-set vars

This commit is contained in:
Brown 2020-09-21 14:33:34 -04:00
parent 7bd1c43be1
commit fe94ae0603

View File

@ -411,9 +411,7 @@ class TryAnalyzer
foreach ($catch_context->vars_in_scope as $var_id => $type) {
if ($stmt_control_actions === [ScopeAnalyzer::ACTION_END]) {
$context->vars_in_scope[$var_id] = $type;
} elseif (isset($context->vars_in_scope[$var_id])
&& !$context->vars_in_scope[$var_id]->equals($type)
) {
} elseif (isset($context->vars_in_scope[$var_id])) {
$context->vars_in_scope[$var_id] = Type::combineUnionTypes(
$context->vars_in_scope[$var_id],
$type