public function testAnnotationDoesNotExist() { $annotation = new MockAnnotation(); $collection = new AnnotationCollection(); $collection->addAnnotation($annotation); $this->assertFalse($collection->exists(MockAnnotation2::class)); }
/** * Get the return type for a response return * * @return null|string */ public function getResponseType() { if (!$this->annotations->exists(ResponseType::NAME)) { return null; } /** @var ResponseType $returnAnnotation */ $returnAnnotation = $this->annotations->get(ResponseType::NAME); return $returnAnnotation->getType(); }
/** * Add unique class annotations to collection * * @param ReflectionClass $reflectionClass * @param AnnotationCollection $annotationCollection */ private function getAdditionalClassAnnotations(ReflectionClass $reflectionClass, AnnotationCollection $annotationCollection) { $annotations = $this->reader->getClassAnnotations($reflectionClass); $annotations = $this->getDynamoAnnotations($annotations); foreach ($annotations as $annotation) { // skip annotations that already exist on method if ($annotationCollection->exists($annotation->getName())) { continue; } $annotationCollection->addAnnotation($annotation); } }