updated-packages
This commit is contained in:
@@ -64,7 +64,7 @@ class Comparator
|
||||
$operator = '==';
|
||||
}
|
||||
|
||||
if (!\in_array($operator, array('>', '<', '>=', '<=', '==', '!='))) {
|
||||
if (!\in_array($operator, ['>', '<', '>=', '<=', '==', '!='])) {
|
||||
throw new \InvalidArgumentException(sprintf('Invalid operator "%s".', $operator));
|
||||
}
|
||||
|
||||
|
@@ -36,7 +36,7 @@ class DateComparator extends Comparator
|
||||
throw new \InvalidArgumentException(sprintf('"%s" is not a valid date.', $matches[2]));
|
||||
}
|
||||
|
||||
$operator = isset($matches[1]) ? $matches[1] : '==';
|
||||
$operator = $matches[1] ?? '==';
|
||||
if ('since' === $operator || 'after' === $operator) {
|
||||
$operator = '>';
|
||||
}
|
||||
|
@@ -41,8 +41,8 @@ class NumberComparator extends Comparator
|
||||
*/
|
||||
public function __construct(?string $test)
|
||||
{
|
||||
if (!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));
|
||||
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'));
|
||||
}
|
||||
|
||||
$target = $matches[2];
|
||||
@@ -74,6 +74,6 @@ class NumberComparator extends Comparator
|
||||
}
|
||||
|
||||
$this->setTarget($target);
|
||||
$this->setOperator(isset($matches[1]) ? $matches[1] : '==');
|
||||
$this->setOperator($matches[1] ?? '==');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user