public function offsetUnset($index)
    {
        if (!isset($this[$index])) {
            throw new \OutOfBoundsException(sprintf('Index %s is invalid or does not exist.', $index));
        }

        $max = \count($this) - 1;
        while ($index < $max) {
            $this[$index] = $this[$index + 1];
            ++$index;
        }

        parent::offsetUnset($index);

        $this->setSize($max);
    }
public function offsetUnset($index)
    {
        if (!isset($this[$index])) {
            throw new \OutOfBoundsException(sprintf('Index %s is invalid or does not exist.', $index));
        }

        $max = \count($this) - 1;
        while ($index < $max) {
            $this[$index] = $this[$index + 1];
            ++$index;
        }

        parent::offsetUnset($index);

        $this->setSize($max);
    }
{@inheritdoc}

@throws \OutOfBoundsException