Skip to content

Commit

Permalink
Fixed implicitly nullable params (#6616)
Browse files Browse the repository at this point in the history
  • Loading branch information
huangdijia authored Mar 23, 2024
1 parent 20e6a20 commit 71b66bd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ResponseBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function __construct(protected DataFormatterInterface $dataFormatter, pro
{
}

public function buildErrorResponse(ServerRequestInterface $request, int $code, Throwable $error = null): ResponsePlusInterface
public function buildErrorResponse(ServerRequestInterface $request, int $code, ?Throwable $error = null): ResponsePlusInterface
{
$body = new SwooleStream($this->formatErrorResponse($request, $code, $error));
return $this->response()->addHeader('content-type', 'application/json')->setBody($body);
Expand All @@ -67,7 +67,7 @@ protected function formatResponse($response, ServerRequestInterface $request): s
return $this->packer->pack($response);
}

protected function formatErrorResponse(ServerRequestInterface $request, int $code, Throwable $error = null): string
protected function formatErrorResponse(ServerRequestInterface $request, int $code, ?Throwable $error = null): string
{
[$code, $message] = $this->error($code, $error?->getMessage());
$response = $this->dataFormatter->formatErrorResponse(
Expand Down

0 comments on commit 71b66bd

Please sign in to comment.