<?php
class A implements IteratorAggregate{
public function getIterator(){
return new B();
}
}
class B implements IteratorAggregate{
public function getIterator(){
return new ArrayIterator(array(1, 2, 3, 4, 5));
}
}
$a = new A();
foreach ($a as $aa){
echo $aa;
}
Deprecated: Return type of A::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/mMJT2 on line 4
Deprecated: Return type of B::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/mMJT2 on line 9
12345