public function setItem(int $index, callable $value) { $count = $this->getCount(); if ($index <= $count) { parent::setItem($index, $value); } else { throw new InvalidArgumentException('Adding items only allowed with [] operator.'); } }
public function __destruct() { unset($this->_emptyCallback); unset($this->_parent); parent::__destruct(); }