Пример #1
0
 public function testClassAnnotationInterface()
 {
     $comment = new Comment('');
     $comment->addAnnotation('someclass', 'whatever');
     $comment->addAnnotation('someclass', 'also whatever');
     $this->assertFalse($comment->hasAnnotationType('whatever'));
     $this->assertTrue($comment->hasAnnotationType('someclass'));
     $this->assertEquals(['whatever', 'also whatever'], $comment->getAnnotationType('someclass'));
 }
Пример #2
0
 /**
  * @param Comment $comment
  * @param AnnotationMetadata $metadata
  */
 private function collectTargetMetadata(Comment $comment, AnnotationMetadata $metadata)
 {
     //@Target
     $targetClassName = Target::class;
     if ($comment->hasAnnotationType($targetClassName)) {
         $metadata->target = array_reduce($comment->getAnnotationType($targetClassName), function ($value, Target $target) {
             return $value | $target->target;
         });
     }
 }