This commit is contained in:
2025-07-11 15:28:10 +08:00
parent 0081a30f22
commit 855da03137
+2 -2
View File
@@ -168,7 +168,7 @@ class Container implements ContainerInterface
} }
if (($handler = $reflect->getConstructor()) !== null) { if (($handler = $reflect->getConstructor()) !== null) {
$construct = $this->getMethodParams($handler); $construct = $this->mergeParams($this->getMethodParams($handler), $construct);
} }
$newInstance = $reflect->newInstanceArgs($construct); $newInstance = $reflect->newInstanceArgs($construct);
@@ -211,7 +211,7 @@ class Container implements ContainerInterface
throw new ReflectionException('Class ' . $reflect->getName() . ' cannot be instantiated'); throw new ReflectionException('Class ' . $reflect->getName() . ' cannot be instantiated');
} }
if (empty($construct) && ($handler = $reflect->getConstructor()) !== null) { if (($handler = $reflect->getConstructor()) !== null) {
$construct = $this->getMethodParams($handler); $construct = $this->getMethodParams($handler);
} }
$newInstance = $reflect->newInstanceArgs($construct); $newInstance = $reflect->newInstanceArgs($construct);