Optimized

This commit is contained in:
huangzhhui 2019-07-02 01:41:10 +08:00
parent e1ee2760c2
commit b22cf3f19a
3 changed files with 4 additions and 4 deletions

View File

@ -62,7 +62,7 @@ class CoreMiddleware extends HttpCoreMiddleware
*
* @return array|Arrayable|mixed|ResponseInterface|string
*/
protected function handleFound(array $routes, ServerRequestInterface $request)
protected function handleFound(array $routes, ServerRequestInterface $request): ResponseInterface
{
[$controller,] = $this->prepareHandler($routes[1]);
if (! $this->container->has($controller)) {

View File

@ -39,8 +39,8 @@ class WebSocketExceptionHandler extends ExceptionHandler
public function handle(Throwable $throwable, ResponseInterface $response)
{
$this->logger->warning($this->formatter->format($throwable));
return $response;
$stream = new SwooleStream((string) $exception->getMessage());
return $response->withBody($stream);
}
public function isValid(Throwable $throwable): bool

View File

@ -39,7 +39,7 @@ class Security
];
}
public function sign(string $key)
public function sign(string $key): string
{
return base64_encode(sha1(trim($key) . self::KEY, true));
}