Skip to content

修复 Ergodic 递归中间件排序问题和类名未引用问题 #367

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/ZM/Annotation/AnnotationParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ class_annotations: [
}
*/

// 保留ergodic注解
$append_ergodics = [];
// 生成主树
$this->annotation_map[$v]['class_annotations'] = $class_annotations;
$this->annotation_map[$v]['methods'] = $methods;
Expand All @@ -120,7 +122,8 @@ class_annotations: [
foreach (($this->annotation_map[$v]['methods'] ?? []) as $method) {
$copy = clone $vs;
$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;
}
}

Expand All @@ -139,6 +142,13 @@ class_annotations: [

$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:处理每个函数上面的特殊注解,就是需要操作一些东西的
foreach (($this->annotation_map[$v]['methods_annotations'] ?? []) as $method_name => $methods_annotations) {
foreach ($methods_annotations as $method_anno) {
Expand Down
2 changes: 1 addition & 1 deletion src/ZM/ConsoleApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ConsoleApplication extends Application
{
public const VERSION_ID = 480;

public const VERSION = '2.8.8';
public const VERSION = '2.8.9';

private static $obj;

Expand Down
4 changes: 2 additions & 2 deletions src/ZM/Store/LightCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static function init(array $config)
} else {
return false;
}
$result = self::$kv_table->set((string)$k, [
$result = self::$kv_table->set((string) $k, [
'value' => $value,
'expire' => $v['expire'],
'data_type' => $data_type,
Expand Down Expand Up @@ -191,7 +191,7 @@ public static function update(string $key, $value)
} elseif (is_bool($value)) {
$data_type = 'bool';
$value = json_encode($value);
} else {
} else {
throw new LightCacheException('E00048', 'Only can set string, array and int');
}
try {
Expand Down
1 change: 1 addition & 0 deletions src/ZM/Store/LightCacheInside.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Exception;
use Swoole\Table;
use ZM\Config\ZMConfig;
use ZM\Exception\LightCacheException;
use ZM\Exception\ZMException;

Expand Down