mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-19 07:12:26 +02:00
N°8834 - Add compatibility with PHP 8.4 (#819)
* N°8834 - Add compatibility with PHP 8.4 * Rollback of scssphp/scssphp version upgrade due to compilation error
This commit is contained in:
@@ -26,17 +26,17 @@ class DateComparator extends Comparator
|
||||
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));
|
||||
throw new \InvalidArgumentException(\sprintf('Don\'t understand "%s" as a date test.', $test));
|
||||
}
|
||||
|
||||
try {
|
||||
$date = new \DateTimeImmutable($matches[2]);
|
||||
$target = $date->format('U');
|
||||
} catch (\Exception) {
|
||||
throw new \InvalidArgumentException(sprintf('"%s" is not a valid date.', $matches[2]));
|
||||
throw new \InvalidArgumentException(\sprintf('"%s" is not a valid date.', $matches[2]));
|
||||
}
|
||||
|
||||
$operator = $matches[1] ?? '==';
|
||||
$operator = $matches[1] ?: '==';
|
||||
if ('since' === $operator || 'after' === $operator) {
|
||||
$operator = '>';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user