update to 2.8.9, fix ergodic order via #365

This commit is contained in:
crazywhalecc
2023-06-12 18:33:31 +08:00
committed by Jerry Ma
parent ea83ea2cce
commit f0cba01bd7
2 changed files with 12 additions and 2 deletions

View File

@@ -105,6 +105,8 @@ class AnnotationParser
} }
*/ */
// 保留ergodic注解
$append_ergodics = [];
// 生成主树 // 生成主树
$this->annotation_map[$v]['class_annotations'] = $class_annotations; $this->annotation_map[$v]['class_annotations'] = $class_annotations;
$this->annotation_map[$v]['methods'] = $methods; $this->annotation_map[$v]['methods'] = $methods;
@@ -120,7 +122,8 @@ class AnnotationParser
foreach (($this->annotation_map[$v]['methods'] ?? []) as $method) { foreach (($this->annotation_map[$v]['methods'] ?? []) as $method) {
$copy = clone $vs; $copy = clone $vs;
$copy->method = $method->getName(); $copy->method = $method->getName();
$this->annotation_map[$v]['methods_annotations'][$method->getName()][] = $copy; $append_ergodics[$method->getName()][] = $copy;
// $this->annotation_map[$v]['methods_annotations'][$method->getName()][] = $copy;
} }
} }
@@ -139,6 +142,13 @@ class AnnotationParser
$inserted = []; $inserted = [];
// 预处理将Class的ergodic注解拼接到每个方法的注解列表前面且按照顺序修复 #365
foreach ($this->annotation_map[$v]['methods_annotations'] as $method_name => $annos) {
if (isset($append_ergodics[$method_name])) {
$this->annotation_map[$v]['methods_annotations'][$method_name] = array_merge($append_ergodics[$method_name], $annos);
}
}
// 预处理3处理每个函数上面的特殊注解就是需要操作一些东西的 // 预处理3处理每个函数上面的特殊注解就是需要操作一些东西的
foreach (($this->annotation_map[$v]['methods_annotations'] ?? []) as $method_name => $methods_annotations) { foreach (($this->annotation_map[$v]['methods_annotations'] ?? []) as $method_name => $methods_annotations) {
foreach ($methods_annotations as $method_anno) { foreach ($methods_annotations as $method_anno) {

View File

@@ -30,7 +30,7 @@ class ConsoleApplication extends Application
{ {
public const VERSION_ID = 480; public const VERSION_ID = 480;
public const VERSION = '2.8.8'; public const VERSION = '2.8.9';
private static $obj; private static $obj;