phpstan / phpstan-strict-rules

Extra strict and opinionated rules for PHPStan
MIT License
604 stars 48 forks source link

Disallow foreach by-reference #226

Open dktapps opened 1 year ago

dktapps commented 1 year ago

Since the variables of foreach can leak out of the foreach, some very surprising things can happen:

https://3v4l.org/b90aa

No error is currently reported; in fact, PHPStan is convinced that no modification took place: https://phpstan.org/r/55072247-b575-43dc-af87-634ddf8f4852