This (bad) code currently emits a PossiblyUndefinedVariable issue. It shouldn't, as Psalm should know that $a is defined whenever $do_thing is !empty.
$do_thing = rand(0, 10) > 5;
if ($do_thing) {
$a = 1;
}
if ($do_thing) {
$b = $a;
}
This code should still emit a PossiblyUndefinedVariable issue, because $do_thing is redefined.
$do_thing = rand(0, 10) > 5;
if ($do_thing) {
$a = 1;
}
$do_thing = rand(0, 10) > 5;
if ($do_thing) {
$b = $a;
}