From 89d7f5df61befe64565884d1e7dbae2e28bf2ab0 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 21 Mar 2024 20:41:21 +0100 Subject: [PATCH] Make implicit nullable types explicit (#359) --- src/Body/FormBody.php | 2 +- src/Connection/Internal/Http1Parser.php | 2 +- src/InvalidRequestException.php | 2 +- src/ParseException.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Body/FormBody.php b/src/Body/FormBody.php index a900d9fc..bf3fc55b 100644 --- a/src/Body/FormBody.php +++ b/src/Body/FormBody.php @@ -30,7 +30,7 @@ final class FormBody implements RequestBody /** * @param string $boundary An optional multipart boundary string */ - public function __construct(string $boundary = null) + public function __construct(?string $boundary = null) { /** @noinspection PhpUnhandledExceptionInspection */ $this->boundary = $boundary ?? \bin2hex(\random_bytes(16)); diff --git a/src/Connection/Internal/Http1Parser.php b/src/Connection/Internal/Http1Parser.php index 83242e92..094a8c93 100644 --- a/src/Connection/Internal/Http1Parser.php +++ b/src/Connection/Internal/Http1Parser.php @@ -110,7 +110,7 @@ public function buffer(string $data): void * * @throws ParseException */ - public function parse(string $data = null): ?Response + public function parse(?string $data = null): ?Response { if ($data !== null) { $this->buffer .= $data; diff --git a/src/InvalidRequestException.php b/src/InvalidRequestException.php index f02570bb..de92226e 100644 --- a/src/InvalidRequestException.php +++ b/src/InvalidRequestException.php @@ -7,7 +7,7 @@ final class InvalidRequestException extends HttpException /** @var Request */ private $request; - public function __construct(Request $request, string $message, int $code = 0, \Throwable $previous = null) + public function __construct(Request $request, string $message, int $code = 0, ?\Throwable $previous = null) { parent::__construct($message, $code, $previous); $this->request = $request; diff --git a/src/ParseException.php b/src/ParseException.php index 111632f1..fd0f2c24 100644 --- a/src/ParseException.php +++ b/src/ParseException.php @@ -9,7 +9,7 @@ final class ParseException extends HttpException * @param int $code * @param \Throwable|null $previousException */ - public function __construct(string $message, int $code, \Throwable $previousException = null) + public function __construct(string $message, int $code, ?\Throwable $previousException = null) { parent::__construct($message, $code, $previousException); }