*/ class RecursiveActionIterator implements RecursiveIterator, \Countable { use Constructor, Iterator, Countable; public $items; /** * @see \Iterator::key() * @return string */ #[\ReturnTypeWillChange] public function key() { /** @var Action $current */ $current = $this->current(); return $current->name; } /** * @see \RecursiveIterator::hasChildren() * @return bool */ public function hasChildren(): bool { /** @var Action $current */ $current = $this->current(); return $current->hasChildren(); } /** * @see \RecursiveIterator::getChildren() * @return RecursiveActionIterator */ public function getChildren(): self { /** @var Action $current */ $current = $this->current(); return new static($current->getChildren()); } }