lint/control-flow/no-loop-variable-overwrite
In the lint-essential preset and every stricter one. Report only. Intent: suspicious. Upstream setting: strictRules.overwriteVariablesWithLoop.
What it does
Disallows a foreach key or value variable overwriting a variable that is already defined.
Configuration
[lint.rules]
"control-flow/no-loop-variable-overwrite" = "error"
To skip it in some files or lines, add an override or an ignore comment.
Replaces
OverwriteVariablesWithForeachRule(phpstan-classes)foreach.keyOverwrite(phpstan-strict-rules)foreach.valueOverwrite(phpstan-strict-rules)