Skip to content

Commit

Permalink
Make implicitly nullable types explicit
Browse files Browse the repository at this point in the history
  • Loading branch information
alcaeus committed Sep 3, 2024
1 parent 4af2e96 commit 8a4b202
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion tests/bulk/bulkwrite-delete-001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class MyClass implements MongoDB\BSON\Persistable
private $id;
private $child;

public function __construct($id, MyClass $child = null)
public function __construct($id, ?MyClass $child = null)
{
$this->id = $id;
$this->child = $child;
Expand Down
2 changes: 1 addition & 1 deletion tests/bulk/bulkwrite-insert-001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class MyClass implements MongoDB\BSON\Persistable
private $id;
private $child;

public function __construct($id, MyClass $child = null)
public function __construct($id, ?MyClass $child = null)
{
$this->id = $id;
$this->child = $child;
Expand Down
2 changes: 1 addition & 1 deletion tests/bulk/bulkwrite-update-001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class MyClass implements MongoDB\BSON\Persistable
private $id;
private $child;

public function __construct($id, MyClass $child = null)
public function __construct($id, ?MyClass $child = null)
{
$this->id = $id;
$this->child = $child;
Expand Down
2 changes: 1 addition & 1 deletion tests/command/command-ctor-001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class MyClass implements MongoDB\BSON\Persistable
private $id;
private $child;

public function __construct($id, MyClass $child = null)
public function __construct($id, ?MyClass $child = null)
{
$this->id = $id;
$this->child = $child;
Expand Down
2 changes: 1 addition & 1 deletion tests/query/query-ctor-001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class MyClass implements MongoDB\BSON\Persistable
private $id;
private $child;

public function __construct($id, MyClass $child = null)
public function __construct($id, ?MyClass $child = null)
{
$this->id = $id;
$this->child = $child;
Expand Down
8 changes: 4 additions & 4 deletions tests/utils/tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function get_module_info($row)
return $matches[1];
}

function create_test_manager(string $uri = null, array $options = [], array $driverOptions = [])
function create_test_manager(?string $uri = null, array $options = [], array $driverOptions = [])
{
if (getenv('API_VERSION') && ! isset($driverOptions['serverApi'])) {
$driverOptions['serverApi'] = new ServerApi(getenv('API_VERSION'));
Expand Down Expand Up @@ -628,7 +628,7 @@ function severityToString(int $severity): string {
* from a particular function. Returns the message from the raised error or
* exception, or an empty string if neither was thrown.
*/
function raises(callable $callable, int $expectedSeverity, string $expectedFromFunction = null): string
function raises(callable $callable, int $expectedSeverity, ?string $expectedFromFunction = null): string
{
set_error_handler(function(int $severity, string $message, string $file, int $line) {
throw new ErrorException($message, 0, $severity, $file, $line);
Expand Down Expand Up @@ -672,7 +672,7 @@ function raises(callable $callable, int $expectedSeverity, string $expectedFromF
* the exception to be thrown from a particular function. Returns the message
* from the thrown exception, or an empty string if one was not thrown.
*/
function throws(callable $callable, string $expectedException, string $expectedFromFunction = null): string
function throws(callable $callable, string $expectedException, ?string $expectedFromFunction = null): string
{
try {
call_user_func($callable);
Expand Down Expand Up @@ -730,7 +730,7 @@ function printWriteResult(WriteResult $result, $details = true)
}
}

function printWriteConcernError(WriteConcernError $error = null, $details)
function printWriteConcernError(?WriteConcernError $error = null, $details = null)
{
if ($error) {
/* This stuff is generated by the server, no need for us to test it */
Expand Down

0 comments on commit 8a4b202

Please sign in to comment.