/** * @return string|null */ public function comment() { if ($this->getter) { $analyzer = new MethodAnalyzer($this->getter); return $analyzer->getReturnComment(); } else { if ($this->setter) { $analyzer = new MethodAnalyzer($this->setter); $comments = array_values($analyzer->getComments()); return $comments[0]; } } return null; }
function testReadComment() { $method = new MethodAnalyzer(new \ReflectionMethod(MethodAnalyzerTest_Foo::$CLASS, 'fourth')); $this->assertEquals($method->getComments(), array('one' => null, 'two' => 'With Comment')); }