public function offsetSet($index, $value): void
    {
        if (!is_object($value)) {
            throw new \InvalidArgumentException("Excepcted object, got ". gettype($value));
        }
        if (!isset($this->class)) {
            $this->class = get_class($value);
        }
        if (get_class($value) === $this->class) {
            parent::offsetSet($index, $value);
        } else {
            throw new \InvalidArgumentException("Excepcted $this->class, got ". get_class($value));
        }
    }