public function setType(int $type)
    {
        $typeList = [
            self::TYPE_INDEX,
            self::TYPE_NEXT_INDEX,
            self::TYPE_PROPERTY,
        ];
        if (!in_array($type, $typeList)) {
            throw new DomainException("Invalid reference type: {$type}");
        }
        $this->type = (int) $type;
        return $this;
    }