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

compile() protected method

empty({expr]})
protected compile ( PhpParser\Node\Expr\Empty_ $expr, Context $context ) : CompiledExpression
$expr PhpParser\Node\Expr\Empty_
$context PHPSA\Context
return PHPSA\CompiledExpression
    protected function compile($expr, Context $context)
    {
        if ($expr->expr instanceof VariableNode) {
            $varName = $expr->expr->name;
            if ($varName instanceof Name) {
                $varName = $varName->parts[0];
            }
            $variable = $context->getSymbol($varName);
            if ($variable) {
                $variable->incUse();
                if ($variable->getValue() !== null && $variable->getValue() != false) {
                    return CompiledExpression::fromZvalValue(true);
                }
            }
        }
        return CompiledExpression::fromZvalValue(false);
    }
EmptyOp