PHPSA\Compiler\Expression\ClassConstFetch::compile PHP Method

compile() protected method

..
protected compile ( PhpParser\Node\Expr\ClassConstFetch $expr, Context $context ) : CompiledExpression
$expr PhpParser\Node\Expr\ClassConstFetch
$context PHPSA\Context
return PHPSA\CompiledExpression
    protected function compile($expr, Context $context)
    {
        $compiler = $context->getExpressionCompiler();
        if ($expr->name == "class") {
            // @todo return fully qualified classname
            return new CompiledExpression();
        }
        $leftCE = $compiler->compile($expr->class);
        if ($leftCE->isObject()) {
            $leftCEValue = $leftCE->getValue();
            if ($leftCEValue instanceof ClassDefinition) {
                if (!$leftCEValue->hasConst($expr->name, true)) {
                    $context->notice('language_error', sprintf('Constant %s does not exist in %s scope', $expr->name, $expr->class), $expr);
                    return new CompiledExpression(CompiledExpression::UNKNOWN);
                }
                return new CompiledExpression();
            }
        }
        $context->debug('Unknown const fetch', $expr);
        return new CompiledExpression();
    }
ClassConstFetch