PDepend\Source\Language\PHP\AbstractPHPParser::parseConstant PHP Method

parseConstant() protected method

Parses a simple PHP constant use and returns a corresponding node.
Since: 1.0.0
protected parseConstant ( ) : PDepend\Source\AST\ASTNode
return PDepend\Source\AST\ASTNode
    protected function parseConstant()
    {
        $this->tokenStack->push();
        switch ($type = $this->tokenizer->peek()) {
            case Tokens::T_STRING:
                // TODO: Separate node classes for magic constants
            // TODO: Separate node classes for magic constants
            case Tokens::T_DIR:
            case Tokens::T_FILE:
            case Tokens::T_LINE:
            case Tokens::T_NS_C:
            case Tokens::T_FUNC_C:
            case Tokens::T_CLASS_C:
            case Tokens::T_METHOD_C:
                $token = $this->consumeToken($type);
                $const = $this->builder->buildAstConstant($token->image);
                break;
        }
        return $this->setNodePositionsAndReturn($const);
    }
AbstractPHPParser