diff --git a/HttpServer/Client/Result.php b/HttpServer/Client/Result.php index 99751ff0..c6e5673d 100644 --- a/HttpServer/Client/Result.php +++ b/HttpServer/Client/Result.php @@ -21,8 +21,8 @@ class Result public $code; public $message; public int $count = 0; - public array|string $data; - public array $header; + public ?array $data; + public ?array $header; public int $httpStatus = 200; public int $startTime = 0; diff --git a/HttpServer/Server.php b/HttpServer/Server.php index 20defdd9..ef554156 100644 --- a/HttpServer/Server.php +++ b/HttpServer/Server.php @@ -88,14 +88,22 @@ class Server extends Application $annotation->register('websocket', AWebsocket::class); $this->enableCoroutine((bool)Config::get('settings.enable_coroutine')); - foreach ($this->sortServers($configs) as $server) { + + $this->orders($configs); + $this->onProcessListener(); + return $this->getServer(); + } + + + private function orders($configs) + { + $servers = $this->sortServers($configs); + foreach ($servers as $server) { $this->create($server); if (!$this->baseServer) { return null; } } - $this->onProcessListener(); - return $this->getServer(); }