Skip to content

Commit

Permalink
Add explicit nullable types
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandre-daubois committed Apr 11, 2024
1 parent 18f86b6 commit 218f69f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/InMemoryStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/LineReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion lib/PendingReadError.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/ResourceOutputStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 218f69f

Please # to comment.