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');