vimeo / psalm

A static analysis tool for finding errors in PHP applications
https://psalm.dev
MIT License
5.57k stars 660 forks source link

Add warning when checking `instanceof iterable` #8292

Open AndrolGenhald opened 2 years ago

AndrolGenhald commented 2 years ago

iterable is a weird pseudotype, and while it's technically allowed to check it with instanceof, it always returns false.

https://3v4l.org/gNWrQ https://psalm.dev/r/53b6ff0007

psalm-github-bot[bot] commented 2 years ago

I found these snippets:

https://psalm.dev/r/53b6ff0007 ```php for $arr is always iterable ```