protected function storeIteratorState()
{
if (!$this->startedIterating) {
$this->current = null;
$this->key = null;
$this->valid = false;
return null;
}
$this->current = $this->ensureIterator()->current();
$this->key = $this->ensureIterator()->key();
$this->valid = $this->ensureIterator()->valid();
if ($this->current !== null) {
$this->current = TypeConverter::toLegacy($this->current);
}
return $this->current;
}