Upgrade framework
This commit is contained in:
@@ -19,13 +19,11 @@ namespace Symfony\Component\Finder\Comparator;
|
||||
class DateComparator extends Comparator
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $test A comparison string
|
||||
*
|
||||
* @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));
|
||||
@@ -38,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 = '>';
|
||||
}
|
||||
@@ -47,7 +45,6 @@ class DateComparator extends Comparator
|
||||
$operator = '<';
|
||||
}
|
||||
|
||||
$this->setOperator($operator);
|
||||
$this->setTarget($target);
|
||||
parent::__construct($target, $operator);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user