This commit is contained in:
2025-07-11 15:55:15 +08:00
parent 7de790d65f
commit 450b8c6cd0
+1 -17
View File
@@ -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);