diff --git a/HttpServer/Http/Formatter/HtmlFormatter.php b/HttpServer/Http/Formatter/HtmlFormatter.php index 81f3aa2d..63d39119 100644 --- a/HttpServer/Http/Formatter/HtmlFormatter.php +++ b/HttpServer/Http/Formatter/HtmlFormatter.php @@ -23,7 +23,7 @@ use HttpServer\IInterface\IFormatter; class HtmlFormatter extends HttpService implements IFormatter { - public $data; + public mixed $data; /** @var Response */ public Response $status; diff --git a/HttpServer/Http/Request.php b/HttpServer/Http/Request.php index 5b26ef91..365038e7 100644 --- a/HttpServer/Http/Request.php +++ b/HttpServer/Http/Request.php @@ -465,7 +465,7 @@ class Request extends HttpService $sRequest->params->setPosts($request->post ?? []); } - $sRequest->headers = new HttpHeaders(ArrayAccess::merge($request->server, $request->header)); + $sRequest->headers = new HttpHeaders(array_merge($request->server, $request->header)); $sRequest->uri = $sRequest->headers->get('request_uri'); $sRequest->parseUri(); @@ -475,11 +475,11 @@ class Request extends HttpService /** * @param $frame - * @param $route + * @param string $route * @param string $event * @return Request */ - public static function socketQuery($frame, $event = Socket::MESSAGE, $route = 'event'): Request + public static function socketQuery($frame, string $event = Socket::MESSAGE, string $route = 'event'): Request { $sRequest = new Request(); $sRequest->fd = $frame->fd; diff --git a/HttpServer/Http/Response.php b/HttpServer/Http/Response.php index 87db94ce..f3341b8a 100644 --- a/HttpServer/Http/Response.php +++ b/HttpServer/Http/Response.php @@ -155,7 +155,7 @@ class Response extends HttpService * @return bool * @throws Exception */ - public function send($context = '', int $statusCode = 200): mixed + public function send(string $context = '', int $statusCode = 200): mixed { $sendData = $this->parseData($context); @@ -192,19 +192,18 @@ class Response extends HttpService /** * @param $result - * @return string + * @return void * @throws Exception */ - private function printResult($result): string + private function printResult($result): void { $result = Help::toString($result); $string = PHP_EOL . 'Command Result: ' . PHP_EOL . PHP_EOL; fire('CONSOLE_END'); if (str_contains((string)$result, 'Event::rshutdown(): Event::wait()')) { - return (string)$result; + return; } - if (empty($result)) { $string .= 'success!' . PHP_EOL . PHP_EOL; } else { @@ -212,8 +211,6 @@ class Response extends HttpService } $string .= 'Command End!' . PHP_EOL . PHP_EOL; print_r($string); - - return (string)$result; } /** @@ -297,7 +294,7 @@ class Response extends HttpService * @return mixed * @throws Exception */ - public function close($statusCode = 200, $message = ''): mixed + public function close(int $statusCode = 200, string $message = ''): mixed { return $this->send($message, $statusCode); } @@ -309,7 +306,7 @@ class Response extends HttpService * @param string $message * @return mixed */ - public function closeClient($clientId, $statusCode = 200, $message = ''): mixed + public function closeClient($clientId,int $statusCode = 200,string $message = ''): mixed { $socket = Snowflake::getWebSocket(); if (!$socket->exist($clientId)) { @@ -326,7 +323,7 @@ class Response extends HttpService * @param int $sleep * @return string */ - public function sendFile(string $path, $offset = 0, $limit = 1024000, $sleep = 0): string + public function sendFile(string $path, int $offset = 0, int $limit = 1024000, int $sleep = 0): string { $open = fopen($path, 'r');