From c22eba62175112391384c408ceb5e26a1ae2b02b Mon Sep 17 00:00:00 2001 From: "as2252258@163.com" Date: Tue, 27 Jul 2021 04:21:09 +0800 Subject: [PATCH] modify --- System/Di/Container.php | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/System/Di/Container.php b/System/Di/Container.php index 5cd2dcd5..55ead113 100644 --- a/System/Di/Container.php +++ b/System/Di/Container.php @@ -239,19 +239,13 @@ class Container extends BaseObject if ($method->isStatic()) { continue; } - static::$_reflectionMethod[$class->getName()][$method->getName()] = $method; - static::$_methodsAttributes[$class->getName()][$method->getName()] = []; + $this->setReflectionMethod($class, $method); foreach ($method->getAttributes() as $attribute) { if (!class_exists($attribute->getName())) { continue; } - - $instance = $attribute->newInstance(); - - $this->setAttributeMapping($attribute, $class, $method, $instance); - $this->setMethodsAttributes($class, $method, $instance); - static::$_methodsAttributes[$class->getName()][$method->getName()][] = $attribute->newInstance(); + $this->setMethodsAttributes($class, $method, $attribute->newInstance()); } } } @@ -262,12 +256,12 @@ class Container extends BaseObject * @param \ReflectionClass $class * @param $object */ - private function setAttributeMapping(\ReflectionAttribute $attribute, ReflectionClass $class, $object) + private function setReflectionMethod(ReflectionClass $class, \ReflectionMethod $method) { - if (!isset(static::$_attributeMaping[$attribute->getName()])) { - static::$_attributeMaping[$attribute->getName()] = []; + if (!isset(static::$_attributeMaping[$class->getName()])) { + static::$_attributeMaping[$class->getName()] = []; } - static::$_attributeMaping[$attribute->getName()][$class->getName()][] = $object; + static::$_attributeMaping[$class->getName()][$method->getName()][] = $method; }