Feature request
I run into a piece of code that I'd swear PHPStan would be able to understand it but it doesn't. I wonder if that's on purpose or maybe I'm misunderstanding something.
Here is the snippet: https://phpstan.org/r/870e4f7c-d387-4506-9117-bf99e41eb570
And the PHP code to compare the output: https://3v4l.org/1Icqf#v8.3.17
In a nutshell, in a foreach loop, with array_shift, PHPStan is considering the array as non-empty because of the default value set before the foreach but it is not smart enough to see it could be empty since the array_shift could strip all values inside the loop.
So the ! empty( $ads ) conditional is a valid in this instance.
Did PHPStan help you today? Did it make you happy in any way?
Yes! Every single day! <3