When extending from an system interfaces the inheritance is not checked.
interface ContainerInterface extends \RecursiveIterator
{
/**
* @param string|callable $filter
* @return ContainerInterface
*/
public function filter($filter, array $params = []): self;
}
the RecursiveIterator extends the Iterator interface which has current, key, next, ... methods
class Item implements ContainerInterface
{
/**
* @var ContainerInterface
*/
private $container;
/**
* @return Item
*/
public function current()
{
return $this->container->current();
}
}
results in an
ERROR: UndefinedInterfaceMethod - Item.php - Method ContainerInterface::current does not exist
return $this->container->current();
I'm not sure what the bug is here?
ContainerInterface extends \RecursiveIterator which extends the \Iterator interface
ContainerInterface contains therefore the methods from Iterator interface for example current()
But plsam give an error that ContainerInterface::current is not defined!
The code you've given doesn't run: https://3v4l.org/1booS
@muglug see https://psalm.dev/r/298d878a38
@weirdan thx for the example!
Thanks all! That was a bad bug, I'm sorry.
Most helpful comment
Thanks all! That was a bad bug, I'm sorry.