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
{{ message }}
Repository navigation
An assignment on the right of || in a while condition is possibly undefined after the loop #13765
A variable assigned on the right of || in a while condition is possibly undefined after the loop, although the loop only exits once the whole condition is false, so both operands were evaluated and the assignment ran:
php-parser's ParserAbstract::doParse() has this pattern: its error recovery assigns $action in such a condition and reads it after the loop. Once a possibly undefined variable reads as T|null (#13762), this gives false PossiblyNullOperand / PossiblyNullArgument / PossiblyNullArrayOffset there.
Psalm output (using commit 5940d8a):
ERROR: InvalidDocblock - 9:44 - Attempt to check undefined variable $a
INFO: PossiblyUndefinedVariable - 10:12 - Possibly undefined variable $a, first seen on line 6
INFO: MixedReturnStatement - 10:12 - Could not infer a return type
Activity
psalm-github-bot commentedon Nov 14, 2026
I found these snippets:
https://psalm.dev/r/e08650e0d1
fix(loop): only the condition that decides the exit defines what its …
fix(loop): a variable assigned in the right operand of || is defined …