From 43e44c9b7e3a2ebc16e95f105e0bb31fea2185c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Mon, 22 Feb 2021 19:25:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- System/Di/Container.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/System/Di/Container.php b/System/Di/Container.php index ff0917ab..736e22cc 100644 --- a/System/Di/Container.php +++ b/System/Di/Container.php @@ -76,7 +76,7 @@ class Container extends BaseObject return $this->resolve($class, $constrict, $config); } $definition = $this->_constructs[$class]; - var_dump($definition); + var_dump($class, $definition); if (is_callable($definition, TRUE)) { return call_user_func($definition, $this, $constrict, $config); } else if (is_array($definition)) { @@ -132,7 +132,6 @@ class Container extends BaseObject foreach ($constrict as $index => $param) { $dependencies[$index] = $param; } - var_dump($reflect); if (!$reflect->isInstantiable()) { throw new NotFindClassException($reflect->getName()); } @@ -169,11 +168,16 @@ class Container extends BaseObject }; $constructs = $reflection->getConstructor(); if (!($constructs instanceof \ReflectionMethod)) { - return [$reflection, $this->_constructs[$class] = []]; + return [ + $reflection, $this->_constructs[$class] = [ + 'class' => $class + ] + ]; } foreach ($constructs->getParameters() as $key => $param) { $dependencies[] = $this->resolveDefaultValue($param); } + $dependencies['class'] = $class; $this->_constructs[$class] = $dependencies; return [$reflection, $dependencies]; }