From 01d5355c24f067e8660f6925c24475a06bae0121 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Mon, 22 Feb 2021 19:58:44 +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 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/System/Di/Container.php b/System/Di/Container.php index 73bc828d..71bf69ef 100644 --- a/System/Di/Container.php +++ b/System/Di/Container.php @@ -119,8 +119,10 @@ class Container extends BaseObject private function resolve($class, $constrict, $config): object { [$reflect, $dependencies] = $this->resolveDependencies($class); - foreach ($constrict as $index => $param) { - $dependencies[$index] = $param; + if (!empty($constrict)) { + foreach ($constrict as $index => $param) { + $dependencies[$index] = $param; + } } if (!$reflect->isInstantiable()) { throw new Exception($reflect->getName() . ' con\'t instantiable');