From ef1d5428140ed1214ca22b84824382dfd9493e0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Thu, 2 Sep 2021 11:27:59 +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 --- core/Di/Container.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/core/Di/Container.php b/core/Di/Container.php index 02bef992..488b5a1f 100644 --- a/core/Di/Container.php +++ b/core/Di/Container.php @@ -17,7 +17,6 @@ use Kiri\Abstracts\Logger; use Kiri\Exception\NotFindClassException; use Kiri\Kiri; use Psr\Log\LoggerInterface; -use Psr\Log\Test\TestLogger; use ReflectionClass; use ReflectionException; use ReflectionFunction; @@ -203,7 +202,7 @@ class Container extends BaseObject implements ContainerInterface { foreach ($this->getPropertyNote($reflect) as $property => $inject) { /** @var Inject $inject */ - $inject->execute($object, $property); + $inject->execute($object, $property); } return $object; } @@ -252,7 +251,7 @@ class Container extends BaseObject implements ContainerInterface private function onAfterInit($object, $config): mixed { Kiri::configure($object, $config); - if (method_exists($object, 'init')) { + if (method_exists($object, 'init') && is_callable([$object, 'init'])) { call_user_func([$object, 'init']); } return $object;