You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a case where I need to create an Iterator from a \Ds\Vector. Since Vector is Traversable but doesn't implement Iterator or IteratorAggregate I thought I'd just use IteratorIterator. This is however broken.
It is the general PHP iterator protocol that you mustrewind before doing any other iterator operations. Anything else is not guaranteed, as you see here.
I have a case where I need to create an
Iterator
from a\Ds\Vector
. SinceVector
isTraversable
but doesn't implementIterator
orIteratorAggregate
I thought I'd just useIteratorIterator
. This is however broken.Testing code:
Expected result:
truetrue
Actual result:
falsetrue
Calling
rewind
on theIteratorIterator
fixes the issue though so maybe it's ok. Not sure. It was just a bit confusing for me.The text was updated successfully, but these errors were encountered: