z-engine dev-master bridges the engine's get_iterator handler to userland iterators. Implementing ObjectGetIteratorInterface::__getIterator() returning an iterator over rows would make foreach ($matrix as $i => $row) work without implementing Traversable on the class.
Contract notes from z-engine: by-reference iteration is rejected by the bridge, and iterator methods must not throw across the FFI boundary (errors surface as E_USER_WARNING and iteration terminates) — keep the iterator allocation-only over the already-validated internal array.
z-engine dev-master bridges the engine's
get_iteratorhandler to userland iterators. ImplementingObjectGetIteratorInterface::__getIterator()returning an iterator over rows would makeforeach ($matrix as $i => $row)work without implementingTraversableon the class.Contract notes from z-engine: by-reference iteration is rejected by the bridge, and iterator methods must not throw across the FFI boundary (errors surface as
E_USER_WARNINGand iteration terminates) — keep the iterator allocation-only over the already-validated internal array.