Bug report
I have a problem with a custom class implementing Iterator, specifically Iterator::current using PHP built-in function current() on an internal array. The current() function may return an array item or false:
If the internal pointer points beyond the end of the elements list or the array is empty, current() returns false.
PHPStan thinks foreach loop items may be false when in reality that cannot happen.
Not sure whether this stems from the Iterator::current method implementation though, because I also have "false" in annotations of methods next() (using function next()) and rewind() (using function reset()).
Code snippet that reproduces the problem
https://phpstan.org/r/2fefbc8d-c1f2-4ee8-bc04-59a3ef0be3cd
Note that two more errors are displayed in strict mode but I think these are wrong, too.