Phan\AST\ContextNode::getOrCreateVariable PHP 메소드

getOrCreateVariable() 공개 메소드

public getOrCreateVariable ( ) : Variable
리턴 Phan\Language\Element\Variable A variable in scope or a new variable
    public function getOrCreateVariable() : Variable
    {
        try {
            return $this->getVariable();
        } catch (IssueException $exception) {
            // Swallow it
        }
        // Create a new variable
        $variable = Variable::fromNodeInContext($this->node, $this->context, $this->code_base, false);
        $this->context->addScopeVariable($variable);
        return $variable;
    }