Skip to content

Commit dc9cf0e

Browse files
[4.x] Fix compare method callback handling and enforce stricter PHPUnit configuration
- Update `compare` method to properly check for null array keys before determining callback handling logic - Enable `failOnWarning` and `failOnRisky` in `phpunit.xml` configuration to improve test reliability
1 parent 5062721 commit dc9cf0e

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

phpunit.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
44
bootstrap="vendor/autoload.php"
55
colors="true"
6+
failOnWarning="true"
7+
failOnRisky="true"
68
>
79
<testsuites>
810
<testsuite name="Test Suite">

src/Benchmark.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ public function round(?int $precision): self
8585
public function compare(array|Closure ...$callbacks): static
8686
{
8787
$values = match (true) {
88-
is_array($callbacks[0]) => $callbacks[0],
89-
is_array($callbacks) => $callbacks,
90-
default => func_get_args()
88+
is_array($callbacks[0] ?? null) => $callbacks[0],
89+
is_array($callbacks) => $callbacks,
90+
default => func_get_args()
9191
};
9292

9393
$this->clear();

0 commit comments

Comments
 (0)