public function getContext($annotation) { if ($annotation instanceof AbstractAnnotation) { return $annotation->_context; } if ($this->annotations->contains($annotation) === false) { throw new Exception('Annotation not found'); } $context = $this->annotations[$annotation]; if ($context instanceof Context) { return $context; } var_dump($context); ob_flush(); die; throw new Exception('Annotation has no context'); // Weird, did you use the addAnnotation/addAnnotations methods? }