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"); }