mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-03-17 20:54:52 +08:00
add AnnotationReader ignore name config (build 445, 2.7.0-beta5)
This commit is contained in:
parent
44a0eec74c
commit
2b8cab1824
@ -44,6 +44,12 @@ $config['runtime'] = [
|
||||
'reload_delay_time' => 800,
|
||||
'global_middleware_binding' => [],
|
||||
'save_console_log_file' => false, // 改为目标路径,则将 Console 输出的日志保存到文件
|
||||
'annotation_reader_ignore' => [ // 设置注解解析器忽略的注解名或命名空间,防止解析到不该解析的
|
||||
'name' => [
|
||||
'mixin',
|
||||
],
|
||||
'namespace' => [],
|
||||
],
|
||||
];
|
||||
|
||||
/* 轻量字符串缓存,默认开启 */
|
||||
|
||||
@ -65,6 +65,19 @@ class AnnotationParser
|
||||
foreach ($this->path_list as $path) {
|
||||
Console::debug('parsing annotation in ' . $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());
|
||||
foreach ($all_class as $v) {
|
||||
Console::debug('正在检索 ' . $v);
|
||||
|
||||
@ -28,9 +28,9 @@ use ZM\Exception\InitException;
|
||||
|
||||
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;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user