This commit is contained in:
2026-06-12 23:57:19 +08:00
parent 0ff2cd7a06
commit 7827b8d5b1
6 changed files with 147 additions and 116 deletions
+16 -2
View File
@@ -225,7 +225,14 @@ class Container implements ContainerInterface
$construct = $this->getMethodParams($handler);
}
$newInstance = $reflect->newInstanceArgs($construct);
$isController = class_exists(\Kiri\Router\Base\Controller::class) && $reflect->isSubclassOf(\Kiri\Router\Base\Controller::class);
$needsProxy = !$isController && class_exists(\Kiri\Router\Annotate\DeferRegistry::class) && \Kiri\Router\Annotate\DeferRegistry::hasAny($className);
if ($needsProxy) {
$newInstance = \Kiri\Router\Annotate\DeferProxyGenerator::create($className, $construct);
} else {
$newInstance = $reflect->newInstanceArgs($construct);
}
return $this->runInit($reflect, static::configure($newInstance, $config));
}
@@ -252,7 +259,14 @@ class Container implements ContainerInterface
if (empty($construct) && ($handler = $reflect->getConstructor()) !== null) {
$construct = $this->getMethodParams($handler);
}
$newInstance = $reflect->newInstanceArgs($construct);
$isController = class_exists(\Kiri\Router\Base\Controller::class) && $reflect->isSubclassOf(\Kiri\Router\Base\Controller::class);
$needsProxy = !$isController && class_exists(\Kiri\Router\Annotate\DeferRegistry::class) && \Kiri\Router\Annotate\DeferRegistry::hasAny($reflect->getName());
if ($needsProxy) {
$newInstance = \Kiri\Router\Annotate\DeferProxyGenerator::create($reflect->getName(), $construct);
} else {
$newInstance = $reflect->newInstanceArgs($construct);
}
return $this->runInit($reflect, static::configure($newInstance, $config));
}