Bug report
When implementing PHP's Iterator without native return types, PHPStan complains about that. This is great because this way we can find code that otherwise would trigger a runtime deprecation on PHP 8.1.
However, it does so on next(), next() and rewind(), but not on current() and key().
Code snippet that reproduces the problem
/**
* @implements Iterator<int, mixed>
*/
class MyIterator implements Iterator
{
public function current()
{
return null;
}
public function next()
{
}
public function key()
{
return 0;
}
public function valid()
{
return false;
}
public function rewind()
{
}
}
https://phpstan.org/r/a8b27f70-a29e-42a8-8252-19a854325434
Expected output
I would expect five errors here, but I only get three. The PHP runtime triggers five runtime deprecations for that piece of code.
Did PHPStan help you today? Did it make you happy in any way?
PHPStan did help us a lot when migrating a legacy codebase to PHP 8.1.
Bug report
When implementing PHP's
Iteratorwithout native return types, PHPStan complains about that. This is great because this way we can find code that otherwise would trigger a runtime deprecation on PHP 8.1.However, it does so on
next(),next()andrewind(), but not oncurrent()andkey().Code snippet that reproduces the problem
https://phpstan.org/r/a8b27f70-a29e-42a8-8252-19a854325434
Expected output
I would expect five errors here, but I only get three. The PHP runtime triggers five runtime deprecations for that piece of code.
Did PHPStan help you today? Did it make you happy in any way?
PHPStan did help us a lot when migrating a legacy codebase to PHP 8.1.