Class %s cannot implement both Iterator and IteratorAggregate at the same time¶
Description¶
This error appears when a class uses two or more interfaces, which are incompatible with one another. The incompatibility is based on name conflicts: two interfaces have a method with the same name.
There is a distinct error for constants. There is the same message for properties, since PHP 8.4.
Example¶
<?php
class A implements Iterator, IteratorAggregate {}
?>
Literal Examples¶
Class A cannot implement both Iterator and IteratorAggregate at the same time
Solutions¶
Choose one or the other interface.
Use the interface that is compatible with the parent classes.