add addSingleAnnotation for AnnotationMap

This commit is contained in:
crazywhalecc
2023-01-12 09:45:34 +08:00
parent 6854304d64
commit 9867004c7d

View File

@@ -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[]
*/