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;
    }
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;
    }
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 ; }
Sets reference type.

@param int $type
@return $this
@throws DomainException
Sets reference type .