public function offsetUnset($offset)
    {
        $this->generatorToArray();

        if ($this->array === []) {
            return;
        }

        if (\array_key_exists($offset, $this->array)) {
            unset($this->array[$offset]);

            return;
        }

        if (
            $this->pathSeparator
            &&
            \is_string($offset)
            &&
            \strpos($offset, $this->pathSeparator) !== false
        ) {
            $path = \explode($this->pathSeparator, (string) $offset);

            if ($path !== false) {
                $pathToUnset = \array_pop($path);

                $this->callAtPath(
                    \implode($this->pathSeparator, $path),
                    static function (&$offset) use ($pathToUnset) {
                        unset($offset[$pathToUnset]);
                    }
                );
            }
        }

        unset($this->array[$offset]);
    }