From 43bb7c97d6ba44f8e9ac59b5794553bd58c0f422 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Thu, 23 Jun 2022 10:44:06 +0800 Subject: [PATCH] modify plugin name --- Abstracts/AsyncServer.php | 2 +- Abstracts/TraitServer.php | 12 ++++++++---- Server.php | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Abstracts/AsyncServer.php b/Abstracts/AsyncServer.php index d7cd725..222b013 100644 --- a/Abstracts/AsyncServer.php +++ b/Abstracts/AsyncServer.php @@ -91,7 +91,7 @@ class AsyncServer implements ServerInterface /** * @return void * @throws ContainerExceptionInterface - * @throws NotFoundExceptionInterface + * @throws NotFoundExceptionInterface|ReflectionException */ public function shutdown(): void { diff --git a/Abstracts/TraitServer.php b/Abstracts/TraitServer.php index 1e2513f..7b08c61 100644 --- a/Abstracts/TraitServer.php +++ b/Abstracts/TraitServer.php @@ -16,13 +16,17 @@ trait TraitServer /** - * @param array $class + * @param string|array $class * @return void */ - public function addProcess(array $class): void + public function addProcess(string|array $class): void { - foreach ($class as $item) { - $this->_process[] = $item; + if (is_string($class)) { + $this->_process[] = $class; + } else { + foreach ($class as $name) { + $this->_process[] = $name; + } } } diff --git a/Server.php b/Server.php index 1ed0fc3..88fadb3 100644 --- a/Server.php +++ b/Server.php @@ -175,7 +175,7 @@ class Server extends HttpService $reload = Config::get('reload.hot', false); if ($reload !== false) { $this->provider->on(OnWorkerStart::class, [$this, 'LoadRoutingList']); - $this->processManager->add(Scaner::class); + $this->manager->addProcess(Scaner::class); } else { $this->LoadRoutingList(); }