getDocComment())){ $info['doc'] = $doc; } } if($select !== null){ $select = array_flip($select); } foreach ($reader->getClassAnnotations($reflection, $record_doc) as $id =>$ann ){ if($select !==null && !array_key_exists($id, $select)){ continue; } $ann=$ann[0];//可能有多个重名的, 只取第一个 $info[$id] = $ann; } foreach ($reflection->getMethods() as $method ){ foreach ( $reader->getMethodAnnotations($method, $record_doc) as $id => $ann){ if($select !==null && !array_key_exists($id, $select)){ continue; } $ann=$ann[0];//可能有多个重名的, 只取第一个 $info += array($id=>array()); $info[$id][$method->getName()] = $ann; } } foreach ($reflection->getProperties() as $property ){ foreach ( $reader->getPropertyAnnotations($property, $record_doc) as $id => $ann){ if($select !==null && !array_key_exists($id, $select)){ continue; } $ann = $ann[0];//可能有多个重名的, 只取第一个 $info += array($id=>array()); $info[$id][$property->getName()] = $ann; } } return $info; } static function testAnnotation(){ Verify::isTrue(count(self::get(new AnnotationTest(),true)), 'Annotation dose not work! If opcache is enable, please set opcache.save_comments=1 and opcache.load_comments=1'); } /** * 有效的元信息 * @var unknown */ private static $valid=array(); } ?>