Cleanup old Composer dependencies

This commit is contained in:
Frédéric Guillot
2020-10-04 14:25:16 -07:00
parent 8322876d8e
commit b7c200373a
72 changed files with 453 additions and 3111 deletions

View File

@@ -31,12 +31,7 @@ class Comparator
return $this->target;
}
/**
* Sets the target value.
*
* @param string $target The target value
*/
public function setTarget($target)
public function setTarget(string $target)
{
$this->target = $target;
}
@@ -54,17 +49,15 @@ class Comparator
/**
* Sets the comparison operator.
*
* @param string $operator A valid operator
*
* @throws \InvalidArgumentException
*/
public function setOperator($operator)
public function setOperator(string $operator)
{
if (!$operator) {
if ('' === $operator) {
$operator = '==';
}
if (!in_array($operator, array('>', '<', '>=', '<=', '==', '!='))) {
if (!\in_array($operator, ['>', '<', '>=', '<=', '==', '!='])) {
throw new \InvalidArgumentException(sprintf('Invalid operator "%s".', $operator));
}

View File

@@ -23,7 +23,7 @@ class DateComparator extends Comparator
*
* @throws \InvalidArgumentException If the test is not understood
*/
public function __construct($test)
public function __construct(string $test)
{
if (!preg_match('#^\s*(==|!=|[<>]=?|after|since|before|until)?\s*(.+?)\s*$#i', $test, $matches)) {
throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a date test.', $test));

View File

@@ -39,7 +39,7 @@ class NumberComparator extends Comparator
*
* @throws \InvalidArgumentException If the test is not understood
*/
public function __construct($test)
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));