From 9867004c7d4fdb3698e22081ce82a565ec2ae2eb Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Thu, 12 Jan 2023 09:45:34 +0800 Subject: [PATCH] add addSingleAnnotation for AnnotationMap --- src/ZM/Annotation/AnnotationMap.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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[] */