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
Confusing messaging for undefined variables in loops #2032
@@ @@+ 3: Function noloop() has no return typehint specified.+ 3: Function noloop() has parameter $foo with no value type specified in iterable type array.
4: Undefined variable: $undefined
+11: Function loop() has no return typehint specified.+11: Function loop() has parameter $foo with no value type specified in iterable type array.
13: Variable $undefined might not be defined.
Full report
Line
Error
3
Function noloop() has no return typehint specified.
3
Function noloop() has parameter $foo with no value type specified in iterable type array.
4
Undefined variable: $undefined
11
Function loop() has no return typehint specified.
11
Function loop() has parameter $foo with no value type specified in iterable type array.
@@ @@+ 3: Function noloop() has no return type specified.+ 3: Function noloop() has parameter $foo with no value type specified in iterable type array.
4: Undefined variable: $undefined
+11: Function loop() has no return type specified.+11: Function loop() has parameter $foo with no value type specified in iterable type array.
13: Variable $undefined might not be defined.
Full report
Line
Error
3
Function noloop() has no return type specified.
3
Function noloop() has parameter $foo with no value type specified in iterable type array.
4
Undefined variable: $undefined
11
Function loop() has no return type specified.
11
Function loop() has parameter $foo with no value type specified in iterable type array.
Activity
phpstan-bot commentedon Mar 9, 2021
@muglug PHPStan now reports different result with your code snippet:
Full report
Function noloop() has no return typehint specified.Function noloop() has parameter $foo with no value type specified in iterable type array.Undefined variable: $undefinedFunction loop() has no return typehint specified.Function loop() has parameter $foo with no value type specified in iterable type array.Variable $undefined might not be defined.phpstan-bot commentedon Sep 16, 2021
@muglug After the latest commit in dev-master, PHPStan now reports different result with your code snippet:
Full report
Function noloop() has no return type specified.Function noloop() has parameter $foo with no value type specified in iterable type array.Undefined variable: $undefinedFunction loop() has no return type specified.Function loop() has parameter $foo with no value type specified in iterable type array.Variable $undefined might not be defined.Add regression test for certainty of undefined variables in loops
Add regression test for certainty of undefined variables in loops
Add regression test for certainty of undefined variables in loops
Add regression test for certainty of undefined variables in loops
Add regression test for certainty of undefined variables in loops
Add regression test for certainty of undefined variables in loops
Add regression test for certainty of undefined variables in loops
Add regression test for certainty of undefined variables in loops
Add regression test for certainty of undefined variables in loops
Add regression test for certainty of undefined variables in loops
Add regression test for certainty of undefined variables in loops
13 remaining items
Add regression test for certainty of undefined variables in loops
Add regression test for certainty of undefined variables in loops
Add regression test for certainty of undefined variables in loops
Add regression test for certainty of undefined variables in loops
Add regression test for certainty of undefined variables in loops
Add regression test for certainty of undefined variables in loops
Add regression test for certainty of undefined variables in loops
Add regression test for certainty of undefined variables in loops
Add regression test for certainty of undefined variables in loops
Add regression test for certainty of undefined variables in loops
Add regression test for certainty of undefined variables in loops
Add regression test for certainty of undefined variables in loops
Add regression test for certainty of undefined variables in loops
github-actions commentedon Aug 29, 2026
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.