diff --git a/src/ZM/Annotation/AnnotationMap.php b/src/ZM/Annotation/AnnotationMap.php index 2f883b38..207e39b6 100644 --- a/src/ZM/Annotation/AnnotationMap.php +++ b/src/ZM/Annotation/AnnotationMap.php @@ -37,6 +37,19 @@ class AnnotationMap self::$_map = array_merge_recursive(self::$_map, $map); } + /** + * 添加一个独立的注解到全局注解列表中 + * + * @param AnnotationBase $annotation 注解对象 + */ + public static function addSingleAnnotation(AnnotationBase $annotation): void + { + self::$_list[get_class($annotation)][] = $annotation; + if ($annotation->class !== '') { + self::$_map[$annotation->class][$annotation->method][] = $annotation; + } + } + /** * @return AnnotationBase[] */