Esempio n. 1
0
 public function testUnanotatedClassCanHaveAnotatedField()
 {
     $reflection = new ReflectionClass('SomeOtherClass');
     $property = $reflection->getProperty('field1');
     $finder = new DocComment();
     $this->assertEqual($finder->get($property), '/** field doccomment */');
 }
Esempio n. 2
0
 public static function getDocComment($reflection)
 {
     if (self::checkRawDocCommentParsingNeeded()) {
         $docComment = new DocComment();
         return $docComment->get($reflection);
     }
     return $reflection->getDocComment();
 }
Esempio n. 3
0
 public static function clearCache()
 {
     self::$classes = array();
     self::$methods = array();
     self::$fields = array();
     self::$parsedFiles = array();
 }
Esempio n. 4
0
 static function parseMethods($class)
 {
     $rc = new \ReflectionClass($class);
     foreach ($rc->getMethods() as $m) {
         (yield $m => DocComment::parse($m->getDocComment()));
     }
 }
Esempio n. 5
0
 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;
 }
Esempio n. 6
0
 public function testRawComment()
 {
     $doc = new DocComment(self::DOC_BLOCK);
     $this->assertSame(self::DOC_BLOCK, $doc->getRawComment());
 }