Fixed bug.

This commit is contained in:
李铭昕 2019-01-31 17:34:28 +08:00
parent 483166c0bf
commit ae2a5c4193
3 changed files with 23 additions and 19 deletions

View File

@ -43,6 +43,7 @@
},
"replace": {
"hyperf/amqp": "self.version",
"hyperf/cache": "self.version",
"hyperf/config": "self.version",
"hyperf/constants": "self.version",
"hyperf/contract": "self.version",
@ -72,6 +73,7 @@
],
"psr-4": {
"Hyperf\\Amqp\\": "src/amqp/src/",
"Hyperf\\Cache\\": "src/cache/src/",
"Hyperf\\Config\\": "src/config/src/",
"Hyperf\\Constants\\": "src/constants/src/",
"Hyperf\\Contract\\": "src/contract/src/",
@ -109,6 +111,7 @@
"hyperf": {
"config": [
"Hyperf\\Amqp\\ConfigProvider",
"Hyperf\\Cache\\ConfigProvider",
"Hyperf\\Config\\ConfigProvider",
"Hyperf\\Devtool\\ConfigProvider",
"Hyperf\\DbConnection\\ConfigProvider",

View File

@ -52,5 +52,4 @@ class AnnotationCollector extends MetadataCollector
{
return static::get($class . '._c.' . $annotation);
}
}

View File

@ -80,26 +80,28 @@ trait ProxyTrait
{
$aspects = AspectCollector::get('classes');
$matchAspect = [];
foreach ($aspects as $aspect => [$rule]) {
if (strpos($rule, '*') !== false) {
$preg = str_replace(['*', '\\'], ['.*', '\\\\'], $rule);
$pattern = "/^${preg}$/";
if (! preg_match($pattern, $className)) {
foreach ($aspects as $aspect => $rules) {
foreach ($rules as $rule) {
if (strpos($rule, '*') !== false) {
$preg = str_replace(['*', '\\'], ['.*', '\\\\'], $rule);
$pattern = "/^${preg}$/";
if (! preg_match($pattern, $className)) {
continue;
}
} elseif ($rule !== $className) {
continue;
}
} elseif ($rule !== $className) {
continue;
}
if (strpos($rule, '::') !== false) {
[$expectedClass, $expectedMethod] = explode('::', $rule);
if ($expectedClass === $className && $expectedMethod === $method) {
$matchAspect[] = $aspect;
break;
}
} else {
if ($rule === $className) {
$matchAspect[] = $aspect;
break;
if (strpos($rule, '::') !== false) {
[$expectedClass, $expectedMethod] = explode('::', $rule);
if ($expectedClass === $className && $expectedMethod === $method) {
$matchAspect[] = $aspect;
break;
}
} else {
if ($rule === $className) {
$matchAspect[] = $aspect;
break;
}
}
}
}