Example #1
0
 /**
  * Gets the fully qualified class name for the class,
  * property or method on which the doc comment is located.
  *
  * @return string A fully qualified class name.
  */
 public function getClassContext()
 {
     return parent::getDeclaringClass()->getName();
 }
Example #2
0
 /**
  * Test if the `SingleParameterAnnotation` class has correct values.
  */
 public function testSingleParameterAnnotation()
 {
     $class = 'com\\mohiva\\test\\resources\\common\\lang\\annotations\\SingleParameter';
     $reflection = new ReflectionProperty(self::TEST_CLASS, 'singleParameter');
     $iterator = $reflection->getAnnotationList()->getAnnotations(SingleParameter::NAME)->getIterator();
     /* @var \com\mohiva\test\resources\common\lang\annotations\SingleParameter $annotation */
     $annotation = $iterator->current();
     $this->assertInstanceOf($class, $annotation);
     $this->assertSame($annotation->getParam1(), 'param1');
     $iterator->next();
     $annotation = $iterator->current();
     $this->assertInstanceOf($class, $annotation);
     $this->assertSame($annotation->getParam1(), 'param1');
 }
Example #3
0
 /**
  * Test if the `getAnnotationList` method return a list of all annotations in a doc comment.
  */
 public function testGetAnnotationList()
 {
     $property = new ReflectionProperty('\\com\\mohiva\\test\\resources\\common\\lang\\AnnotationTest', 'nested');
     $this->assertInstanceOf('com\\mohiva\\common\\lang\\AnnotationList', $property->getAnnotationList());
 }