current; } /** * @return int|null */ #[ReturnTypeWillChange] public function key() { return $this->position; } /** * @return void */ #[ReturnTypeWillChange] public function next() { if (++$this->position < $this->size) { $this->current = $this->getValue(); } } /** * @return bool */ #[ReturnTypeWillChange] public function valid() { return $this->position < $this->size; } /** * Returns the number of items comprising the whole multibulk response. * * This method should be used instead of iterator_count() to get the size of * the current multibulk response since the former consumes the iteration to * count the number of elements, but our iterators do not support rewinding. * * @return int */ #[ReturnTypeWillChange] public function count() { return $this->size; } /** * Returns the current position of the iterator. * * @return int */ public function getPosition() { return $this->position; } /** * {@inheritdoc} */ abstract protected function getValue(); }