Menu

← Back to all error identifiers

Error Identifiers: foreach.*

There are 10 error identifiers in the foreach.* group:

  • Foreach iterates over an empty array, so the loop body never executes.
  • foreach.keyOverwrite phpstan-strict-rules
    Foreach key variable overwrites an existing variable in the current scope.
  • The key variable of a foreach loop is overwritten before it is ever read.
  • Expression passed to foreach is not an iterable type.
  • The key variable of a foreach loop is never read in the loop body.
  • The key variable of a foreach loop is read, but only to compute values that are themselves never used.
  • The value variable of a foreach loop is never read in the loop body.
  • The value variable of a foreach loop is read, but only to compute values that are themselves never used.
  • foreach.valueOverwrite phpstan-strict-rules
    Foreach value variable overwrites an existing variable in the current scope.
  • The value variable of a foreach loop is overwritten before it is ever read.
Theme
A
© 2026 PHPStan s.r.o.