Phan\Language\Context::getElementInScope PHP Method

getElementInScope() public method

public getElementInScope ( CodeBase $code_base ) : TypedElement
$code_base Phan\CodeBase The code base from which to retrieve the TypedElement
return Phan\Language\Element\TypedElement The element who's scope we're in. If we're in the global scope this method will go down in flames and take your process with it.
    public function getElementInScope(CodeBase $code_base) : TypedElement
    {
        assert($this->isInElementScope(), "Cannot get element in scope if we're in the global scope");
        if ($this->isInFunctionLikeScope()) {
            return $this->getFunctionLikeInScope($code_base);
        } else {
            if ($this->isInClassScope()) {
                return $this->getClassInScope($code_base);
            }
        }
        throw new CodeBaseException(null, "Cannot get element in scope if we're in the global scope");
    }