Skip to content

Commit

Permalink
fix loops
Browse files Browse the repository at this point in the history
  • Loading branch information
orklah authored and muglug committed Dec 15, 2021
1 parent 66db521 commit fcafa20
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/Psalm/Internal/Type/SimpleAssertionReconciler.php
Original file line number Diff line number Diff line change
Expand Up @@ -512,9 +512,16 @@ private static function reconcileIsset(
}
}

if ($existing_var_type->hasType('empty')) {
$existing_var_type->removeType('empty');
$existing_var_type->addType(new TMixed($inside_loop));
if ($inside_loop) {
if ($existing_var_type->hasType('empty')) {
$existing_var_type->removeType('empty');
$existing_var_type->addType(new TMixed(true));
}

if ($existing_var_type->hasType('never')) {
$existing_var_type->removeType('never');
$existing_var_type->addType(new TMixed(true));
}
}

$existing_var_type->from_property = false;
Expand Down

0 comments on commit fcafa20

Please sign in to comment.