/** * Gets parent class * * @return AnnotatedClass */ public function getParentClass() { if (false === $this->parent) { $this->parent = parent::getParentClass(); if ($this->parent) { $this->parent = new self($this->parent->getName()); } } return $this->parent; }
/** * Constructor * * @param AnnotatedClass $declaring The declaring class * @param string $name The name of the property * @param array $annotations The property annotations if they are parsed already */ public function __construct(AnnotatedClass $declaring, $name, array $annotations = []) { parent::__construct($declaring->getName(), $name); $this->declaring = $declaring; if ($annotations) { $this->annotations = $annotations; } else { $this->findAnnotations(); } }
/** * @covers ::getMethodsWithAnnotation */ public function testGetMethodsWithAnnotation() { $methods = $this->fixture->getMethodsWithAnnotation(Headzoo\Method::class); $this->assertCount(3, $methods); $this->assertInstanceOf(AnnotatedMethod::class, $methods["getCounter"]); $annotations = $this->fixture->getMethodsWithAnnotation(Headzoo\Method::class, true); $this->assertCount(3, $annotations); $this->assertInstanceOf(Method::class, $annotations["getCounter"]); }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. */ public function setUp() { $class = new AnnotatedClass(ChildPerson::class); $this->fixture = $class->getMethod("getCounter"); }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. */ public function setUp() { $class = new AnnotatedClass(ChildPerson::class); $this->fixture = $class->getProperty("counter"); }