public function isValidConstantType()
    {
        if ($this->type === self::TYPE_AUTO) {
            $type = $this->determineType($this->value);
        } else {
            $type = $this->type;
        }

        // Valid types for constants.
        $scalarTypes = [
            self::TYPE_BOOLEAN,
            self::TYPE_NUMBER,
            self::TYPE_INTEGER,
            self::TYPE_FLOAT,
            self::TYPE_DOUBLE,
            self::TYPE_STRING,
            self::TYPE_CONSTANT,
            self::TYPE_NULL,
            self::TYPE_EXPRESSION
        ];

        return in_array($type, $scalarTypes);
    }