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
For loop - Variable might not be defined even if it is defined #11218
@@ @@-11: Offset 'test' does not exist on array{}|array{test: literal-string&non-falsy-string}.+11: Offset 'test' might not exist on array{}|array{test: literal-string&non-falsy-string}.
Activity
ondrejmirtes commentedon Jun 21, 2024
There are many ways how to rewrite this code so that PHPStan doesn't report an error: https://phpstan.org/r/073f7f16-e6d1-4f14-9c92-2fe0a925e123
I agree this shouldn't be reported, but it's hard for static analyser to understand what's going on.
phpstan-bot commentedon Sep 23, 2024
@JulienChavee After the latest push in 2.0.x, PHPStan now reports different result with your code snippet:
Full report
phpstan-bot commentedon Apr 13, 2026
Closed via merging phpstan/phpstan-src#5386
github-actions commentedon May 15, 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.