upgraded dependencies
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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user