src/AnnotationContext.php
public function getClass()
    {
        if (isset($this->context['class'])) {
            return $this->context['class'];
        }

        $cls = null;
        if (isset($this->context['property'])) {
            $cls = $this->context['property']->getDeclaringClass();
        } elseif (isset($this->context['method'])) {
            $cls = $this->context['method']->getDeclaringClass();
        }

        if ($cls) {
            return $this->context['class'] = $cls;
        }

        throw new \BadMethodCallException(sprintf('%s called from a function context', __METHOD__));
    }
public function getClass()
    {
        if (isset($this->context['class'])) {
            return $this->context['class'];
        }

        $cls = null;
        if (isset($this->context['property'])) {
            $cls = $this->context['property']->getDeclaringClass();
        } elseif (isset($this->context['method'])) {
            $cls = $this->context['method']->getDeclaringClass();
        }

        if ($cls) {
            return $this->context['class'] = $cls;
        }

        throw new \BadMethodCallException(sprintf('%s called from a function context', __METHOD__));
    }
{@inheritdoc}