From 54eabc948f385b3652d2d4d4c9828d6e2b004648 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Wed, 4 May 2022 21:03:59 +0800 Subject: [PATCH] fix instant mode related files --- src/ZM/Module/ModuleBase.php | 13 +++++++++++-- src/ZM/ZMServer.php | 19 +++++++++++++------ 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/ZM/Module/ModuleBase.php b/src/ZM/Module/ModuleBase.php index 4bad0c26..1a64e017 100644 --- a/src/ZM/Module/ModuleBase.php +++ b/src/ZM/Module/ModuleBase.php @@ -9,23 +9,32 @@ namespace ZM\Module; */ abstract class ModuleBase { + /** @var string 模块名称 */ protected $module_name; + /** @var array 事件列表 */ protected $events = []; - public function __construct($module_name) + /** + * @param string $module_name 模块名称 + */ + public function __construct(string $module_name) { $this->module_name = $module_name; } /** - * @return mixed + * 获取模块名称 + * @return string */ public function getModuleName() { return $this->module_name; } + /** + * 获取事件列表 + */ public function getEvents(): array { return $this->events; diff --git a/src/ZM/ZMServer.php b/src/ZM/ZMServer.php index 798f35f8..cbc1203f 100644 --- a/src/ZM/ZMServer.php +++ b/src/ZM/ZMServer.php @@ -15,21 +15,31 @@ use ZM\Module\ModuleBase; */ class ZMServer { + /** @var string App名称 */ protected $app_name; /** @var ModuleBase[] */ protected $modules = []; - public function __construct($app_name) + /** + * @param string $app_name App名称 + */ + public function __construct(string $app_name) { $this->app_name = $app_name; } + /** + * @param mixed $module_class + */ public function addModule($module_class) { $this->modules[] = $module_class; } + /** + * @throws InitException + */ public function run() { Console::setLevel(4); @@ -39,7 +49,7 @@ class ZMServer } } echo "Running...\n"; - if (defined('WORKDING_DIR')) { + if (defined('WORKING_DIR')) { throw new InitException(); } @@ -57,10 +67,7 @@ class ZMServer (new Framework($options, true))->start(); } - /** - * @return mixed - */ - public function getAppName() + public function getAppName(): string { return $this->app_name; }