From eb785dcfda40866a9bba9ae536c80e377645b496 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Thu, 25 Mar 2021 18:30:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gii/GiiController.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Gii/GiiController.php b/Gii/GiiController.php index 30f56e1e..c6c935fc 100644 --- a/Gii/GiiController.php +++ b/Gii/GiiController.php @@ -26,10 +26,10 @@ class GiiController extends GiiBase /** - * @return string - * @throws Exception + * @return string|bool + * @throws \ReflectionException */ - public function generate(): string + public function generate(): string|bool { $path = $this->getControllerPath(); $modelPath = $this->getModelPath(); @@ -50,10 +50,14 @@ namespace {$namespace}; '; if (file_exists($path['path'] . '/' . $managerName . 'Controller.php')) { - $class = Snowflake::getDi()->getReflect($controller); + try { + $class = new \ReflectionClass($controller); - $import = $this->getImports($path['path'] . '/' . $managerName . 'Controller.php', $class); - }else{ + $import = $this->getImports($path['path'] . '/' . $managerName . 'Controller.php', $class); + } catch (\Throwable $exception) { + return logger()->addError($exception); + } + } else { $import = "use Snowflake; use exception; use Annotation\Target;