mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-29 03:25:34 +08:00
add AnnotationReader ignore name config (build 445, 2.7.0-beta5)
This commit is contained in:
@@ -44,6 +44,12 @@ $config['runtime'] = [
|
|||||||
'reload_delay_time' => 800,
|
'reload_delay_time' => 800,
|
||||||
'global_middleware_binding' => [],
|
'global_middleware_binding' => [],
|
||||||
'save_console_log_file' => false, // 改为目标路径,则将 Console 输出的日志保存到文件
|
'save_console_log_file' => false, // 改为目标路径,则将 Console 输出的日志保存到文件
|
||||||
|
'annotation_reader_ignore' => [ // 设置注解解析器忽略的注解名或命名空间,防止解析到不该解析的
|
||||||
|
'name' => [
|
||||||
|
'mixin',
|
||||||
|
],
|
||||||
|
'namespace' => [],
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
/* 轻量字符串缓存,默认开启 */
|
/* 轻量字符串缓存,默认开启 */
|
||||||
|
|||||||
@@ -65,6 +65,19 @@ class AnnotationParser
|
|||||||
foreach ($this->path_list as $path) {
|
foreach ($this->path_list as $path) {
|
||||||
Console::debug('parsing annotation in ' . $path[0] . ':' . $path[1]);
|
Console::debug('parsing annotation in ' . $path[0] . ':' . $path[1]);
|
||||||
$all_class = ZMUtil::getClassesPsr4($path[0], $path[1]);
|
$all_class = ZMUtil::getClassesPsr4($path[0], $path[1]);
|
||||||
|
|
||||||
|
$conf = ZMConfig::get('global', 'runtime')['annotation_reader_ignore'] ?? [];
|
||||||
|
if (isset($conf['name']) && is_array($conf['name'])) {
|
||||||
|
foreach ($conf['name'] as $v) {
|
||||||
|
AnnotationReader::addGlobalIgnoredName($v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isset($conf['namespace']) && is_array($conf['namespace'])) {
|
||||||
|
foreach ($conf['namespace'] as $v) {
|
||||||
|
AnnotationReader::addGlobalIgnoredNamespace($v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AnnotationReader::addGlobalIgnoredName('mixin');
|
||||||
$this->reader = new DualReader(new AnnotationReader(), new AttributeReader());
|
$this->reader = new DualReader(new AnnotationReader(), new AttributeReader());
|
||||||
foreach ($all_class as $v) {
|
foreach ($all_class as $v) {
|
||||||
Console::debug('正在检索 ' . $v);
|
Console::debug('正在检索 ' . $v);
|
||||||
|
|||||||
@@ -28,9 +28,9 @@ use ZM\Exception\InitException;
|
|||||||
|
|
||||||
class ConsoleApplication extends Application
|
class ConsoleApplication extends Application
|
||||||
{
|
{
|
||||||
public const VERSION_ID = 444;
|
public const VERSION_ID = 445;
|
||||||
|
|
||||||
public const VERSION = '2.7.0-beta4';
|
public const VERSION = '2.7.0-beta5';
|
||||||
|
|
||||||
private static $obj;
|
private static $obj;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user