mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-12-05 14:33:49 +09:00
Update to laravel 7
This commit is contained in:
57
vendor/symfony/finder/Comparator/Comparator.php
vendored
57
vendor/symfony/finder/Comparator/Comparator.php
vendored
@@ -12,8 +12,6 @@
|
||||
namespace Symfony\Component\Finder\Comparator;
|
||||
|
||||
/**
|
||||
* Comparator.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class Comparator
|
||||
@@ -21,30 +19,44 @@ class Comparator
|
||||
private $target;
|
||||
private $operator = '==';
|
||||
|
||||
public function __construct(string $target = null, string $operator = '==')
|
||||
{
|
||||
if (null === $target) {
|
||||
trigger_deprecation('symfony/finder', '5.4', 'Constructing a "%s" without setting "$target" is deprecated.', __CLASS__);
|
||||
}
|
||||
|
||||
$this->target = $target;
|
||||
$this->doSetOperator($operator);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the target value.
|
||||
*
|
||||
* @return string The target value
|
||||
* @return string
|
||||
*/
|
||||
public function getTarget()
|
||||
{
|
||||
if (null === $this->target) {
|
||||
trigger_deprecation('symfony/finder', '5.4', 'Calling "%s" without initializing the target is deprecated.', __METHOD__);
|
||||
}
|
||||
|
||||
return $this->target;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the target value.
|
||||
*
|
||||
* @param string $target The target value
|
||||
* @deprecated set the target via the constructor instead
|
||||
*/
|
||||
public function setTarget($target)
|
||||
public function setTarget(string $target)
|
||||
{
|
||||
trigger_deprecation('symfony/finder', '5.4', '"%s" is deprecated. Set the target via the constructor instead.', __METHOD__);
|
||||
|
||||
$this->target = $target;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the comparison operator.
|
||||
*
|
||||
* @return string The operator
|
||||
* @return string
|
||||
*/
|
||||
public function getOperator()
|
||||
{
|
||||
@@ -54,21 +66,15 @@ class Comparator
|
||||
/**
|
||||
* Sets the comparison operator.
|
||||
*
|
||||
* @param string $operator A valid operator
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*
|
||||
* @deprecated set the operator via the constructor instead
|
||||
*/
|
||||
public function setOperator($operator)
|
||||
public function setOperator(string $operator)
|
||||
{
|
||||
if (!$operator) {
|
||||
$operator = '==';
|
||||
}
|
||||
trigger_deprecation('symfony/finder', '5.4', '"%s" is deprecated. Set the operator via the constructor instead.', __METHOD__);
|
||||
|
||||
if (!\in_array($operator, ['>', '<', '>=', '<=', '==', '!='])) {
|
||||
throw new \InvalidArgumentException(sprintf('Invalid operator "%s".', $operator));
|
||||
}
|
||||
|
||||
$this->operator = $operator;
|
||||
$this->doSetOperator('' === $operator ? '==' : $operator);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -80,6 +86,10 @@ class Comparator
|
||||
*/
|
||||
public function test($test)
|
||||
{
|
||||
if (null === $this->target) {
|
||||
trigger_deprecation('symfony/finder', '5.4', 'Calling "%s" without initializing the target is deprecated.', __METHOD__);
|
||||
}
|
||||
|
||||
switch ($this->operator) {
|
||||
case '>':
|
||||
return $test > $this->target;
|
||||
@@ -95,4 +105,13 @@ class Comparator
|
||||
|
||||
return $test == $this->target;
|
||||
}
|
||||
|
||||
private function doSetOperator(string $operator): void
|
||||
{
|
||||
if (!\in_array($operator, ['>', '<', '>=', '<=', '==', '!='])) {
|
||||
throw new \InvalidArgumentException(sprintf('Invalid operator "%s".', $operator));
|
||||
}
|
||||
|
||||
$this->operator = $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 = '>';
|
||||
}
|
||||
@@ -45,7 +45,6 @@ class DateComparator extends Comparator
|
||||
$operator = '<';
|
||||
}
|
||||
|
||||
$this->setOperator($operator);
|
||||
$this->setTarget($target);
|
||||
parent::__construct($target, $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];
|
||||
@@ -73,7 +73,6 @@ class NumberComparator extends Comparator
|
||||
}
|
||||
}
|
||||
|
||||
$this->setTarget($target);
|
||||
$this->setOperator(isset($matches[1]) ? $matches[1] : '==');
|
||||
parent::__construct($target, $matches[1] ?: '==');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user