Skip to content

Commit a96bc19

Browse files
committed
bug #41240 Fixed deprecation warnings about passing null as parameter (derrabus)
This PR was merged into the 4.4 branch. Discussion ---------- Fixed deprecation warnings about passing null as parameter | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | N/A | License | MIT | Doc PR | N/A Various built-in PHP functions will trigger a deprecation warning if `null` is passed as parameter. This PR attempts to fix all warnings that our test suite currently picks up. Commits ------- 7d9bdf5734 Fixed deprecation warnings about passing null as parameter
2 parents ccc39d8 + 4675a12 commit a96bc19

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)