Skip to content

Commit 4675a12

Browse files
committed
Fixed deprecation warnings about passing null as parameter
1 parent 67b7771 commit 4675a12

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Comparator/NumberComparator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ class NumberComparator extends Comparator
4141
*/
4242
public function __construct(?string $test)
4343
{
44-
if (!preg_match('#^\s*(==|!=|[<>]=?)?\s*([0-9\.]+)\s*([kmg]i?)?\s*$#i', $test, $matches)) {
45-
throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a number test.', $test));
44+
if (null === $test || !preg_match('#^\s*(==|!=|[<>]=?)?\s*([0-9\.]+)\s*([kmg]i?)?\s*$#i', $test, $matches)) {
45+
throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a number test.', $test ?? 'null'));
4646
}
4747

4848
$target = $matches[2];

0 commit comments

Comments
 (0)