parserProxy = $parserProxy; } public function offsetExists($offset): bool { $exists = parent::offsetExists($offset); while (!$exists && !$this->allParsed) { $child = $this->parserProxy->popNextChild(); if ($child === null) { $this->allParsed = true; } else { $this->add($child); } $exists = parent::offsetExists($offset); } return $exists; } }