From 13b934474375abdee5e456c263d85c91c26d34d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Fri, 23 Sep 2022 18:55:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Abstracts/AsyncServer.php | 6 ++++-- Contract/OnReceiveInterface.php | 2 +- Handler/OnServerManager.php | 6 ++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Abstracts/AsyncServer.php b/Abstracts/AsyncServer.php index 222b013..09c59df 100644 --- a/Abstracts/AsyncServer.php +++ b/Abstracts/AsyncServer.php @@ -89,15 +89,17 @@ class AsyncServer implements ServerInterface /** - * @return void + * @return bool * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface|ReflectionException */ - public function shutdown(): void + public function shutdown(): bool { $this->server->shutdown(); $this->dispatch->dispatch(new OnShutdown()); + + return true; } diff --git a/Contract/OnReceiveInterface.php b/Contract/OnReceiveInterface.php index 149ca5d..2e2775e 100644 --- a/Contract/OnReceiveInterface.php +++ b/Contract/OnReceiveInterface.php @@ -19,7 +19,7 @@ interface OnReceiveInterface * @param string $data * @return void */ - public function onReceive(Server $server, int $fd, int $reactor_id, string $data): void; + public function onReceive(Server $server, int $fd, int $reactor_id, string $data): bool; } diff --git a/Handler/OnServerManager.php b/Handler/OnServerManager.php index 5c3db22..d9a6d34 100644 --- a/Handler/OnServerManager.php +++ b/Handler/OnServerManager.php @@ -34,7 +34,7 @@ class OnServerManager extends Server * @param \Swoole\Server $server * @throws ConfigException * @throws ContainerExceptionInterface - * @throws NotFoundExceptionInterface + * @throws NotFoundExceptionInterface|ReflectionException */ public function onManagerStart(\Swoole\Server $server) { @@ -46,10 +46,12 @@ class OnServerManager extends Server /** * @param \Swoole\Server $server + * @return void * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface + * @throws ReflectionException */ - public function onManagerStop(\Swoole\Server $server) + public function onManagerStop(\Swoole\Server $server): void { $this->dispatch->dispatch(new OnManagerStop($server)); }