Skip to content

Commit 3f7f96f

Browse files
authored
Refactor method signatures to use nullable parameter syntax (#19)
Updated method signatures in test traits to explicitly use nullable types (`?type`) for better consistency and clarity. This ensures type hints properly reflect parameters that can accept `null` as a valid value.
1 parent 67215b4 commit 3f7f96f

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/Traits/DatabaseSchemaTestTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ trait DatabaseSchemaTestTrait
2222
*
2323
* @return void
2424
*/
25-
protected function setUpDatabase(string $schemaFile = null): void
25+
protected function setUpDatabase(?string $schemaFile = null): void
2626
{
2727
if (isset($schemaFile)) {
2828
$this->schemaFile = $schemaFile;

src/Traits/DatabaseTableTestTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ protected function assertTableRow(
4646
*
4747
* @return array Row
4848
*/
49-
protected function getTableRowById(string $table, int $id, array $fields = null): array
49+
protected function getTableRowById(string $table, int $id, ?array $fields = null): array
5050
{
5151
$sql = sprintf('SELECT * FROM `%s` WHERE `id` = :id', $table);
5252
$statement = $this->createPreparedStatement($sql);

src/Traits/HttpJsonTestTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ trait HttpJsonTestTrait
2222
*
2323
* @return ServerRequestInterface
2424
*/
25-
protected function createJsonRequest(string $method, $uri, array $data = null): ServerRequestInterface
25+
protected function createJsonRequest(string $method, $uri, ?array $data = null): ServerRequestInterface
2626
{
2727
$request = $this->createRequest($method, $uri);
2828

src/Traits/HttpTestTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ protected function createRequest(string $method, $uri, array $serverParams = [])
4646
*
4747
* @return ServerRequestInterface The request
4848
*/
49-
protected function createFormRequest(string $method, $uri, array $data = null): ServerRequestInterface
49+
protected function createFormRequest(string $method, $uri, ?array $data = null): ServerRequestInterface
5050
{
5151
$request = $this->createRequest($method, $uri);
5252

0 commit comments

Comments
 (0)