diff --git a/Container.php b/Container.php index d681961..02310f1 100644 --- a/Container.php +++ b/Container.php @@ -177,22 +177,6 @@ class Container implements ContainerInterface } - /** - * @param array $default - * @param array $params - * @return array - */ - protected function mergeParams(array $default, array $params): array - { - if (empty($params)) { - return $default; - } - foreach ($params as $key => $value) { - $default[$key] = $value; - } - return $default; - } - /** * @param ReflectionClass $reflect @@ -211,7 +195,7 @@ class Container implements ContainerInterface throw new ReflectionException('Class ' . $reflect->getName() . ' cannot be instantiated'); } - if (($handler = $reflect->getConstructor()) !== null) { + if (empty($construct) && ($handler = $reflect->getConstructor()) !== null) { $construct = $this->getMethodParams($handler); } $newInstance = $reflect->newInstanceArgs($construct);