From 4b9a04876fc5a76571a3a0712a6128fa076e1e86 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Thu, 11 Apr 2024 16:48:20 +0200 Subject: [PATCH] Add explicit nullable types --- lib/InMemoryStream.php | 2 +- lib/LineReader.php | 2 +- lib/PendingReadError.php | 2 +- lib/ResourceOutputStream.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/InMemoryStream.php b/lib/InMemoryStream.php index c764f41..c591371 100644 --- a/lib/InMemoryStream.php +++ b/lib/InMemoryStream.php @@ -15,7 +15,7 @@ final class InMemoryStream implements InputStream /** * @param string|null $contents Data chunk or `null` for no data chunk. */ - public function __construct(string $contents = null) + public function __construct(?string $contents = null) { $this->contents = $contents; } diff --git a/lib/LineReader.php b/lib/LineReader.php index ed6b0a2..0a3503f 100644 --- a/lib/LineReader.php +++ b/lib/LineReader.php @@ -19,7 +19,7 @@ final class LineReader /** @var InputStream */ private $source; - public function __construct(InputStream $inputStream, string $delimiter = null) + public function __construct(InputStream $inputStream, ?string $delimiter = null) { $this->source = $inputStream; $this->delimiter = $delimiter === null ? "\n" : $delimiter; diff --git a/lib/PendingReadError.php b/lib/PendingReadError.php index 66dc1fb..fd3430d 100644 --- a/lib/PendingReadError.php +++ b/lib/PendingReadError.php @@ -10,7 +10,7 @@ final class PendingReadError extends \Error public function __construct( string $message = "The previous read operation must complete before read can be called again", int $code = 0, - \Throwable $previous = null + ?\Throwable $previous = null ) { parent::__construct($message, $code, $previous); } diff --git a/lib/ResourceOutputStream.php b/lib/ResourceOutputStream.php index 035e480..ee7d50f 100644 --- a/lib/ResourceOutputStream.php +++ b/lib/ResourceOutputStream.php @@ -35,7 +35,7 @@ final class ResourceOutputStream implements OutputStream * @param resource $stream Stream resource. * @param int|null $chunkSize Chunk size per `fwrite()` operation. */ - public function __construct($stream, int $chunkSize = null) + public function __construct($stream, ?int $chunkSize = null) { if (!\is_resource($stream) || \get_resource_type($stream) !== 'stream') { throw new \Error("Expected a valid stream");