-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
Description
Bug report
@implements tag on a \RecursiveIterator doesn't work, but it does with \Iterator.
The following error is being reported:
Class Some\Foo\PeriodRecursive @implements tag contains incompatible type iterable<Some\Foo\Moment>&RecursiveIterator.
Digging into the source code, I found this commit "reverting" the change: phpstan/phpstan-src@aa92b5b
So I assume this is not a bug and it's intentional, but I'm not understanding why this was reverted.
Code snippet that reproduces the problem
Link to the playground, please ignore missing method errors:
https://phpstan.org/r/f5382215-922f-4453-a7d6-de0ae9a524d6
<?php namespace Some\Foo;
class Moment {}
/**
* @implements \Iterator<Moment>
*/
final class Period implements \Iterator
{
}
/**
* @implements \RecursiveIterator<Moment>
*/
final class PeriodRecursive implements \RecursiveIterator
{
}
Expected output
No error is returned, as \RecursiveIterator works the same as \Iterator
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels