We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 67b7771 commit 4675a12Copy full SHA for 4675a12
Comparator/NumberComparator.php
@@ -41,8 +41,8 @@ class NumberComparator extends Comparator
41
*/
42
public function __construct(?string $test)
43
{
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));
+ if (null === $test || !preg_match('#^\s*(==|!=|[<>]=?)?\s*([0-9\.]+)\s*([kmg]i?)?\s*$#i', $test, $matches)) {
+ throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a number test.', $test ?? 'null'));
46
}
47
48
$target = $matches[2];
0 commit comments