Phan\AST\ContextNode::getOrCreateVariable PHP Method

getOrCreateVariable() public method

public getOrCreateVariable ( ) : Variable
return 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;
    }