Skip to content

Commit b367819

Browse files
committed
feat: make repo compatible with phpunit ~10.5
1 parent 7477263 commit b367819

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/Testing/Constraints/CountInDatabase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function failureDescription(mixed $other): string
4747
);
4848
}
4949

50-
public function toString(int $options = 0): string
50+
public function toString(): string
5151
{
5252
return (new ReflectionClass($this))->name;
5353
}

src/Testing/Constraints/HasInDatabase.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use PHPUnit\Framework\Constraint\Constraint;
1212
use Throwable;
1313

14+
use function is_int;
1415
use function json_encode;
1516
use function sprintf;
1617

@@ -58,8 +59,14 @@ public function failureDescription(mixed $other): string
5859
/**
5960
* @throws JsonException
6061
*/
61-
public function toString(int $options = 0): string
62+
public function toString($options = null): string
6263
{
63-
return json_encode($this->data, JSON_THROW_ON_ERROR | $options);
64+
if (is_int($options)) {
65+
$options |= JSON_THROW_ON_ERROR;
66+
} else {
67+
$options = JSON_THROW_ON_ERROR;
68+
}
69+
70+
return json_encode($this->data, $options | $options);
6471
}
6572
}

0 commit comments

Comments
 (0)