Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add explicit nullable types #111

Merged
merged 1 commit into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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