From baaaa3d2f8edb857d3dcedb52233511747f088fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 6 Apr 2021 10:30:23 +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 --- HttpServer/HttpFilter.php | 2 +- HttpServer/Server.php | 31 ++++++++++++------------------- 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/HttpServer/HttpFilter.php b/HttpServer/HttpFilter.php index 9cf6a0cb..2174991a 100644 --- a/HttpServer/HttpFilter.php +++ b/HttpServer/HttpFilter.php @@ -35,7 +35,7 @@ class HttpFilter extends BaseObject /** * @param string $className * @param string $method - * @return bool + * @return bool|Validator * @throws Exception */ public function check(string $className, string $method): bool|Validator diff --git a/HttpServer/Server.php b/HttpServer/Server.php index 99249bcb..c00eb43f 100644 --- a/HttpServer/Server.php +++ b/HttpServer/Server.php @@ -220,7 +220,7 @@ class Server extends HttpService * @throws ConfigException * @throws Exception */ - public function onProcessListener(): mixed + public function onProcessListener(): \Swoole\Server|null|Packet|Receive|Http|Websocket { if (!($this->swoole instanceof \Swoole\Server)) { return $this->swoole; @@ -284,12 +284,13 @@ class Server extends HttpService } - /** - * @param $config - * @return mixed - * @throws Exception - */ - private function create($config): mixed + /** + * @param $config + * @return \Swoole\Server|Packet|Receive|Http|Websocket|null + * @throws ConfigException + * @throws Exception + */ + private function create($config): \Swoole\Server|null|Packet|Receive|Http|Websocket { $settings = Config::get('settings', []); if (!isset($this->server[$config['type']])) { @@ -322,8 +323,6 @@ class Server extends HttpService * @param $config * @param $settings * @return \Swoole\Server|Packet|Receive|Http|Websocket|null - * @throws NotFindClassException - * @throws ReflectionException * @throws Exception */ private function dispatchCreate($config, $settings): \Swoole\Server|Packet|Receive|Http|Websocket|null @@ -341,8 +340,6 @@ class Server extends HttpService /** * @param $config * @return Http|Packet|Receive|Websocket|null - * @throws NotFindClassException - * @throws ReflectionException * @throws Exception */ private function addListener($config): Packet|Websocket|Receive|Http|null @@ -432,10 +429,7 @@ class Server extends HttpService /** * @param $config - * @param $newListener * @return Packet|Websocket|Receive|Http|null - * @throws NotFindClassException - * @throws ReflectionException * @throws Exception */ private function onListenerBind($config): Packet|Websocket|Receive|Http|null @@ -448,11 +442,10 @@ class Server extends HttpService } - /** - * @param $newListener - * @param $config - * @throws Exception - */ + /** + * @param string $type + * @throws Exception + */ private function bindServerEvent($type = self::TCP) { if (in_array($type, [self::PACKAGE, self::TCP])) {