You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In while loops that combine a test for an object's truthiness with another condition, Intelephense incorrectly determines that the variable's type is subsequently never, even though the second part of the expression may have been the one that failed.
To Reproduce
Here's a minimal example. After the loop, Intelephense treats $foo as never.
<?phpclassFoo
{
publicint$Id;
public ?Foo$Next;
}
functionbar(Foo$foo)
{
while ($foo && $foo->Id === -1) {
$foo = $foo->Next;
}
// $foo is `never` but should be `Foo|null`, and Intellisense doesn't workif ($foo) {
echo$foo->Id;
}
}
Platform and version
v1.12.6 on macOS and Linux
The text was updated successfully, but these errors were encountered:
Describe the bug
In
while
loops that combine a test for an object's truthiness with another condition, Intelephense incorrectly determines that the variable's type is subsequentlynever
, even though the second part of the expression may have been the one that failed.To Reproduce
Here's a minimal example. After the loop, Intelephense treats
$foo
asnever
.Platform and version
v1.12.6 on macOS and Linux
The text was updated successfully, but these errors were encountered: