public function testUnanotatedClassCanHaveAnotatedField() { $reflection = new ReflectionClass('SomeOtherClass'); $property = $reflection->getProperty('field1'); $finder = new DocComment(); $this->assertEqual($finder->get($property), '/** field doccomment */'); }
public static function getDocComment($reflection) { if (self::checkRawDocCommentParsingNeeded()) { $docComment = new DocComment(); return $docComment->get($reflection); } return $reflection->getDocComment(); }
public static function clearCache() { self::$classes = array(); self::$methods = array(); self::$fields = array(); self::$parsedFiles = array(); }
static function parseMethods($class) { $rc = new \ReflectionClass($class); foreach ($rc->getMethods() as $m) { (yield $m => DocComment::parse($m->getDocComment())); } }
public static function getDocComment($reflection) { $value = false; if (self::checkRawDocCommentParsingNeeded()) { $docComment = new DocComment(); $value = $docComment->get($reflection); } else { $value = $reflection->getDocComment(); } if ($value) { // get rid of useless '*' and white space from line's start // this will allow dividing of one annotation to multiple lines $value = preg_replace('/^[\\s*]*/m', '', $value); } return $value; }
public function testRawComment() { $doc = new DocComment(self::DOC_BLOCK); $this->assertSame(self::DOC_BLOCK, $doc->getRawComment()); }