Skip to content

Commit f21a111

Browse files
Fix implicit nullable parameters deprecation for PHP 8.4 (#1)
* Fix Implicitly marking parameter $maxItems as nullable is deprecated [0203813] * Change maxItems parameter to nullable integer [542215a] * Fix implicit nullable parameters deprecation in unit tests [43614f1] --------- Co-authored-by: Daniel Rudolf <github.com@daniel-rudolf.de>
1 parent 841db9a commit f21a111

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

src/ArrayAssertsTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public static function arrayHasKeyWith($key, $constraint): ArrayHasKeyWith
158158
public static function assertSequentialArray(
159159
$array,
160160
int $minItems,
161-
int $maxItems = null,
161+
?int $maxItems = null,
162162
$constraint = null,
163163
bool $ignoreKeys = false,
164164
string $message = ''
@@ -185,7 +185,7 @@ public static function assertSequentialArray(
185185
*/
186186
public static function sequentialArray(
187187
int $minItems,
188-
int $maxItems = null,
188+
?int $maxItems = null,
189189
$constraint = null,
190190
bool $ignoreKeys = false
191191
): SequentialArray {

src/Constraint/SequentialArray.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class SequentialArray extends Constraint
7777
*
7878
* @throws InvalidArgumentException
7979
*/
80-
public function __construct(int $minItems = 0, int $maxItems = null, $constraint = null, bool $ignoreKeys = false)
80+
public function __construct(int $minItems = 0, ?int $maxItems = null, $constraint = null, bool $ignoreKeys = false)
8181
{
8282
if ($minItems < 0) {
8383
throw InvalidArgumentException::create(1, 'non-negative integer');

tests/TestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase
5252
protected function mockConstraint(
5353
$constraint,
5454
array $invocationRules = [],
55-
array $evaluateParameters = null
55+
?array $evaluateParameters = null
5656
) {
5757
if (!($constraint instanceof Constraint)) {
5858
return $constraint;

tests/Unit/ArrayAssertsTraitTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ public function dataProviderArrayHasItemWithFail(): array
450450
private function mockConstraintInstance(
451451
string $className,
452452
array $constructorArguments = [],
453-
array $evaluateArguments = null
453+
?array $evaluateArguments = null
454454
): MockInterface {
455455
$instanceMock = Mockery::mock('overload:' . $className, Constraint::class);
456456

0 commit comments

Comments
 (0)