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
Commit 568511a
Browse filesBrowse the repository at this point in the historyBrowse files
Narrow iterated expression to non-empty inside foreach body regardless of polluteScopeWithAlwaysIterableForeach
The in-body narrowing of the iterated expression (list -> non-empty-list,
array -> non-empty-array) was an accidental side effect of the
polluteScopeWithAlwaysIterableForeach scope-pollution mechanism: it only
happened when the flag was true. With the flag set to false (as
phpstan-strict-rules does), the narrowing silently disappeared even though
the loop body is provably entered only when the iteratee is non-empty.
Apply the non-empty narrowing at foreach-body entry from the pre-loop scope
unconditionally, mirroring the previous flag-true behaviour exactly. The flag
now only controls what leaks into the after-loop scope, which is its
documented purpose.
Closesphpstan/phpstan#13312
0 commit comments