From dda4f31dcced5fbcd0662042468cd38a69c090b9 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 20 Sep 2025 16:03:35 +0000 Subject: [PATCH] Version v0.14.0-dev --- VERSION | 2 +- vendor/autoload.php | 5 +- vendor/brick/math/CHANGELOG.md | 17 ++ vendor/brick/math/composer.json | 6 +- vendor/brick/math/phpstan.neon | 14 ++ vendor/brick/math/psalm-baseline.xml | 70 ------ vendor/brick/math/src/BigDecimal.php | 143 +++++++++---- vendor/brick/math/src/BigInteger.php | 201 ++++++++++++------ vendor/brick/math/src/BigNumber.php | 127 +++++++---- vendor/brick/math/src/BigRational.php | 71 ++++--- .../src/Exception/DivisionByZeroException.php | 8 +- .../Exception/IntegerOverflowException.php | 4 +- .../src/Exception/NegativeNumberException.php | 2 +- .../src/Exception/NumberFormatException.php | 7 +- .../Exception/RoundingNecessaryException.php | 4 +- vendor/brick/math/src/Internal/Calculator.php | 123 ++++++----- .../Internal/Calculator/BcMathCalculator.php | 4 +- .../src/Internal/Calculator/GmpCalculator.php | 9 +- .../Internal/Calculator/NativeCalculator.php | 51 +++-- .../math/src/Internal/CalculatorRegistry.php | 73 +++++++ vendor/composer/InstalledVersions.php | 45 +++- vendor/composer/autoload_psr4.php | 4 +- vendor/composer/autoload_static.php | 8 +- vendor/composer/installed.json | 124 +++++------ vendor/composer/installed.php | 52 ++--- vendor/composer/platform_check.php | 5 +- vendor/guzzlehttp/guzzle/CHANGELOG.md | 11 + vendor/guzzlehttp/guzzle/composer.json | 4 +- vendor/guzzlehttp/guzzle/package-lock.json | 6 + .../guzzle/src/Handler/CurlFactory.php | 9 +- .../guzzle/src/Handler/CurlMultiHandler.php | 5 +- .../guzzle/src/Handler/StreamHandler.php | 9 +- vendor/guzzlehttp/guzzle/src/Middleware.php | 4 +- vendor/guzzlehttp/promises/CHANGELOG.md | 7 + vendor/guzzlehttp/promises/README.md | 2 +- vendor/guzzlehttp/promises/composer.json | 2 +- vendor/guzzlehttp/psr7/CHANGELOG.md | 10 + vendor/guzzlehttp/psr7/README.md | 2 +- vendor/guzzlehttp/psr7/composer.json | 2 +- vendor/guzzlehttp/psr7/src/MessageTrait.php | 4 - vendor/guzzlehttp/psr7/src/Utils.php | 4 +- vendor/predis/predis/README.md | 44 ++++ vendor/predis/predis/src/Client.php | 2 +- .../predis/src/ClientContextInterface.php | 27 +++ vendor/predis/predis/src/ClientInterface.php | 20 +- .../predis/src/Command/PrefixableCommand.php | 4 +- .../predis/predis/src/Command/Redis/BITOP.php | 10 + .../src/Command/Redis/BloomFilter/BFADD.php | 7 +- .../Command/Redis/BloomFilter/BFEXISTS.php | 7 +- .../src/Command/Redis/BloomFilter/BFINFO.php | 7 +- .../Command/Redis/BloomFilter/BFINSERT.php | 7 +- .../Command/Redis/BloomFilter/BFLOADCHUNK.php | 7 +- .../src/Command/Redis/BloomFilter/BFMADD.php | 7 +- .../Command/Redis/BloomFilter/BFMEXISTS.php | 7 +- .../Command/Redis/BloomFilter/BFRESERVE.php | 7 +- .../Command/Redis/BloomFilter/BFSCANDUMP.php | 7 +- .../Redis/CountMinSketch/CMSINCRBY.php | 7 +- .../Command/Redis/CountMinSketch/CMSINFO.php | 7 +- .../Redis/CountMinSketch/CMSINITBYDIM.php | 7 +- .../Redis/CountMinSketch/CMSINITBYPROB.php | 7 +- .../Command/Redis/CountMinSketch/CMSMERGE.php | 15 +- .../Command/Redis/CountMinSketch/CMSQUERY.php | 7 +- .../src/Command/Redis/CuckooFilter/CFADD.php | 7 +- .../Command/Redis/CuckooFilter/CFADDNX.php | 7 +- .../Command/Redis/CuckooFilter/CFCOUNT.php | 7 +- .../src/Command/Redis/CuckooFilter/CFDEL.php | 7 +- .../Command/Redis/CuckooFilter/CFEXISTS.php | 7 +- .../src/Command/Redis/CuckooFilter/CFINFO.php | 7 +- .../Command/Redis/CuckooFilter/CFINSERT.php | 7 +- .../Redis/CuckooFilter/CFLOADCHUNK.php | 7 +- .../Command/Redis/CuckooFilter/CFMEXISTS.php | 7 +- .../Command/Redis/CuckooFilter/CFRESERVE.php | 7 +- .../Command/Redis/CuckooFilter/CFSCANDUMP.php | 7 +- .../predis/src/Command/Redis/EXPIRETIME.php | 7 +- .../predis/src/Command/Redis/GEOSEARCH.php | 7 +- .../predis/src/Command/Redis/GETDEL.php | 7 +- .../src/Command/Redis/Json/JSONARRAPPEND.php | 7 +- .../src/Command/Redis/Json/JSONARRINDEX.php | 7 +- .../src/Command/Redis/Json/JSONARRINSERT.php | 7 +- .../src/Command/Redis/Json/JSONARRLEN.php | 7 +- .../src/Command/Redis/Json/JSONARRPOP.php | 7 +- .../src/Command/Redis/Json/JSONARRTRIM.php | 7 +- .../src/Command/Redis/Json/JSONCLEAR.php | 7 +- .../predis/src/Command/Redis/Json/JSONDEL.php | 7 +- .../src/Command/Redis/Json/JSONFORGET.php | 7 +- .../predis/src/Command/Redis/Json/JSONGET.php | 7 +- .../src/Command/Redis/Json/JSONMERGE.php | 7 +- .../src/Command/Redis/Json/JSONMGET.php | 7 +- .../src/Command/Redis/Json/JSONMSET.php | 13 +- .../src/Command/Redis/Json/JSONNUMINCRBY.php | 7 +- .../src/Command/Redis/Json/JSONOBJKEYS.php | 7 +- .../src/Command/Redis/Json/JSONOBJLEN.php | 7 +- .../src/Command/Redis/Json/JSONRESP.php | 7 +- .../predis/src/Command/Redis/Json/JSONSET.php | 7 +- .../src/Command/Redis/Json/JSONSTRAPPEND.php | 7 +- .../src/Command/Redis/Json/JSONSTRLEN.php | 7 +- .../src/Command/Redis/Json/JSONTOGGLE.php | 7 +- .../src/Command/Redis/Json/JSONTYPE.php | 7 +- .../predis/predis/src/Command/Redis/LMOVE.php | 12 +- .../predis/src/Command/Redis/SMISMEMBER.php | 7 +- .../src/Command/Redis/Search/FTAGGREGATE.php | 7 +- .../src/Command/Redis/Search/FTALIASADD.php | 7 +- .../src/Command/Redis/Search/FTALIASDEL.php | 7 +- .../Command/Redis/Search/FTALIASUPDATE.php | 7 +- .../src/Command/Redis/Search/FTALTER.php | 7 +- .../src/Command/Redis/Search/FTCREATE.php | 7 +- .../src/Command/Redis/Search/FTCURSOR.php | 7 +- .../src/Command/Redis/Search/FTDICTADD.php | 7 +- .../src/Command/Redis/Search/FTDICTDEL.php | 7 +- .../src/Command/Redis/Search/FTDICTDUMP.php | 7 +- .../src/Command/Redis/Search/FTDROPINDEX.php | 7 +- .../src/Command/Redis/Search/FTEXPLAIN.php | 7 +- .../src/Command/Redis/Search/FTINFO.php | 7 +- .../src/Command/Redis/Search/FTPROFILE.php | 7 +- .../src/Command/Redis/Search/FTSEARCH.php | 7 +- .../src/Command/Redis/Search/FTSPELLCHECK.php | 7 +- .../src/Command/Redis/Search/FTSYNDUMP.php | 7 +- .../src/Command/Redis/Search/FTSYNUPDATE.php | 7 +- .../src/Command/Redis/Search/FTTAGVALS.php | 7 +- .../src/Command/Redis/TDigest/TDIGESTADD.php | 7 +- .../Command/Redis/TDigest/TDIGESTBYRANK.php | 7 +- .../Redis/TDigest/TDIGESTBYREVRANK.php | 7 +- .../src/Command/Redis/TDigest/TDIGESTCDF.php | 7 +- .../Command/Redis/TDigest/TDIGESTCREATE.php | 7 +- .../src/Command/Redis/TDigest/TDIGESTINFO.php | 7 +- .../src/Command/Redis/TDigest/TDIGESTMAX.php | 7 +- .../Command/Redis/TDigest/TDIGESTMERGE.php | 15 +- .../src/Command/Redis/TDigest/TDIGESTMIN.php | 7 +- .../Command/Redis/TDigest/TDIGESTQUANTILE.php | 7 +- .../src/Command/Redis/TDigest/TDIGESTRANK.php | 7 +- .../Command/Redis/TDigest/TDIGESTRESET.php | 7 +- .../Command/Redis/TDigest/TDIGESTREVRANK.php | 7 +- .../Redis/TDigest/TDIGESTTRIMMED_MEAN.php | 7 +- .../src/Command/Redis/TimeSeries/TSADD.php | 7 +- .../src/Command/Redis/TimeSeries/TSALTER.php | 7 +- .../src/Command/Redis/TimeSeries/TSCREATE.php | 7 +- .../Command/Redis/TimeSeries/TSCREATERULE.php | 12 +- .../src/Command/Redis/TimeSeries/TSDECRBY.php | 7 +- .../src/Command/Redis/TimeSeries/TSDEL.php | 7 +- .../Command/Redis/TimeSeries/TSDELETERULE.php | 7 +- .../src/Command/Redis/TimeSeries/TSGET.php | 7 +- .../src/Command/Redis/TimeSeries/TSINCRBY.php | 7 +- .../src/Command/Redis/TimeSeries/TSINFO.php | 7 +- .../src/Command/Redis/TimeSeries/TSMADD.php | 13 +- .../src/Command/Redis/TimeSeries/TSRANGE.php | 7 +- .../predis/src/Command/Redis/TopK/TOPKADD.php | 7 +- .../src/Command/Redis/TopK/TOPKINCRBY.php | 7 +- .../src/Command/Redis/TopK/TOPKINFO.php | 7 +- .../src/Command/Redis/TopK/TOPKLIST.php | 7 +- .../src/Command/Redis/TopK/TOPKQUERY.php | 7 +- .../src/Command/Redis/TopK/TOPKRESERVE.php | 7 +- .../Command/Redis/Utils/CommandUtility.php | 56 +++++ .../src/Command/Redis/Utils/VectorUtility.php | 40 ++++ .../predis/predis/src/Command/Redis/VADD.php | 86 ++++++++ .../predis/predis/src/Command/Redis/VCARD.php | 26 +++ .../predis/predis/src/Command/Redis/VDIM.php | 26 +++ .../predis/predis/src/Command/Redis/VEMB.php | 70 ++++++ .../predis/src/Command/Redis/VGETATTR.php | 70 ++++++ .../predis/predis/src/Command/Redis/VINFO.php | 40 ++++ .../predis/src/Command/Redis/VLINKS.php | 69 ++++++ .../predis/src/Command/Redis/VRANDMEMBER.php | 41 ++++ .../predis/predis/src/Command/Redis/VREM.php | 35 +++ .../predis/src/Command/Redis/VSETATTR.php | 52 +++++ .../predis/predis/src/Command/Redis/VSIM.php | 94 ++++++++ .../predis/predis/src/Command/Redis/XACK.php | 34 +++ .../predis/src/Command/Redis/XACKDEL.php | 46 ++++ .../predis/predis/src/Command/Redis/XADD.php | 5 + .../predis/src/Command/Redis/XCLAIM.php | 89 ++++++++ .../predis/src/Command/Redis/XDELEX.php | 46 ++++ .../predis/predis/src/Command/Redis/XINFO.php | 49 ++++- .../predis/src/Command/Redis/XPENDING.php | 81 +++++++ .../predis/predis/src/Command/Redis/XREAD.php | 4 + .../predis/src/Command/Redis/XSETID.php | 49 +++++ .../predis/predis/src/Command/Redis/XTRIM.php | 4 + .../predis/src/Command/Redis/ZPOPMAX.php | 7 +- .../predis/src/Command/Redis/ZPOPMIN.php | 7 +- .../Replication/SentinelReplication.php | 12 +- .../predis/src/Connection/Resource/Stream.php | 1 + .../src/Connection/Resource/StreamFactory.php | 6 +- .../src/Connection/StreamConnection.php | 4 +- vendor/ramsey/uuid/composer.json | 2 +- .../uuid/src/Generator/UnixTimeGenerator.php | 8 +- .../uuid/src/Math/BrickMathCalculator.php | 19 +- .../tedivm/jshrink/src/JShrink/Minifier.php | 19 +- 184 files changed, 2723 insertions(+), 607 deletions(-) create mode 100644 vendor/brick/math/phpstan.neon delete mode 100644 vendor/brick/math/psalm-baseline.xml create mode 100644 vendor/brick/math/src/Internal/CalculatorRegistry.php create mode 100644 vendor/guzzlehttp/guzzle/package-lock.json create mode 100644 vendor/predis/predis/src/Command/Redis/Utils/CommandUtility.php create mode 100644 vendor/predis/predis/src/Command/Redis/Utils/VectorUtility.php create mode 100644 vendor/predis/predis/src/Command/Redis/VADD.php create mode 100644 vendor/predis/predis/src/Command/Redis/VCARD.php create mode 100644 vendor/predis/predis/src/Command/Redis/VDIM.php create mode 100644 vendor/predis/predis/src/Command/Redis/VEMB.php create mode 100644 vendor/predis/predis/src/Command/Redis/VGETATTR.php create mode 100644 vendor/predis/predis/src/Command/Redis/VINFO.php create mode 100644 vendor/predis/predis/src/Command/Redis/VLINKS.php create mode 100644 vendor/predis/predis/src/Command/Redis/VRANDMEMBER.php create mode 100644 vendor/predis/predis/src/Command/Redis/VREM.php create mode 100644 vendor/predis/predis/src/Command/Redis/VSETATTR.php create mode 100644 vendor/predis/predis/src/Command/Redis/VSIM.php create mode 100644 vendor/predis/predis/src/Command/Redis/XACK.php create mode 100644 vendor/predis/predis/src/Command/Redis/XACKDEL.php create mode 100644 vendor/predis/predis/src/Command/Redis/XCLAIM.php create mode 100644 vendor/predis/predis/src/Command/Redis/XDELEX.php create mode 100644 vendor/predis/predis/src/Command/Redis/XPENDING.php create mode 100644 vendor/predis/predis/src/Command/Redis/XSETID.php diff --git a/VERSION b/VERSION index b561134..04d403d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v0.13.1 +v0.14.0-dev diff --git a/vendor/autoload.php b/vendor/autoload.php index d70ed24..c8b8f21 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -14,10 +14,7 @@ if (PHP_VERSION_ID < 50600) { echo $err; } } - trigger_error( - $err, - E_USER_ERROR - ); + throw new RuntimeException($err); } require_once __DIR__ . '/composer/autoload_real.php'; diff --git a/vendor/brick/math/CHANGELOG.md b/vendor/brick/math/CHANGELOG.md index a07ba88..377cdae 100644 --- a/vendor/brick/math/CHANGELOG.md +++ b/vendor/brick/math/CHANGELOG.md @@ -2,6 +2,23 @@ All notable changes to this project will be documented in this file. +## [0.14.0](https://github.com/brick/math/releases/tag/0.14.0) - 2025-08-29 + +✨ **New features** + +- New methods: `BigInteger::clamp()` and `BigDecimal::clamp()` (#96 by @JesterIruka) + +✨ **Improvements** + +- All pure methods in `BigNumber` classes are now marked as `@pure` for better static analysis + +💥 **Breaking changes** + +- Minimum PHP version is now 8.2 +- `BigNumber` classes are now `readonly` +- `BigNumber` is now marked as sealed: it must not be extended outside of this package +- Exception classes are now `final` + ## [0.13.1](https://github.com/brick/math/releases/tag/0.13.1) - 2025-03-29 ✨ **Improvements** diff --git a/vendor/brick/math/composer.json b/vendor/brick/math/composer.json index f400aa4..ad1dfe0 100644 --- a/vendor/brick/math/composer.json +++ b/vendor/brick/math/composer.json @@ -19,12 +19,12 @@ ], "license": "MIT", "require": { - "php": "^8.1" + "php": "^8.2" }, "require-dev": { - "phpunit/phpunit": "^10.1", + "phpunit/phpunit": "^11.5", "php-coveralls/php-coveralls": "^2.2", - "vimeo/psalm": "6.8.8" + "phpstan/phpstan": "2.1.22" }, "autoload": { "psr-4": { diff --git a/vendor/brick/math/phpstan.neon b/vendor/brick/math/phpstan.neon new file mode 100644 index 0000000..216ba1e --- /dev/null +++ b/vendor/brick/math/phpstan.neon @@ -0,0 +1,14 @@ +parameters: + level: 10 + checkUninitializedProperties: true + paths: + - src + ignoreErrors: + - '~Impure call to function array_shift\(\) in pure method~' + - '~Possibly impure call to function assert\(\) in pure method~' + - '~Possibly impure call to function hex2bin\(\) in pure method~' + - '~Possibly impure call to function preg_match\(\) in pure method~' + - '~Impure static variable in pure method Brick\\Math\\Big(Integer|Decimal|Rational)::(zero|one|ten)\(\)~' + - + message: '~Parameter #\d \$\S+ of function bc\S+ expects numeric-string, string given~' + path: src/Internal/Calculator/BcMathCalculator.php diff --git a/vendor/brick/math/psalm-baseline.xml b/vendor/brick/math/psalm-baseline.xml deleted file mode 100644 index 112adf4..0000000 --- a/vendor/brick/math/psalm-baseline.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/vendor/brick/math/src/BigDecimal.php b/vendor/brick/math/src/BigDecimal.php index 0932fd6..1a540c7 100644 --- a/vendor/brick/math/src/BigDecimal.php +++ b/vendor/brick/math/src/BigDecimal.php @@ -8,14 +8,13 @@ use Brick\Math\Exception\DivisionByZeroException; use Brick\Math\Exception\MathException; use Brick\Math\Exception\NegativeNumberException; use Brick\Math\Internal\Calculator; +use Brick\Math\Internal\CalculatorRegistry; use Override; /** * Immutable, arbitrary-precision signed decimal numbers. - * - * @psalm-immutable */ -final class BigDecimal extends BigNumber +final readonly class BigDecimal extends BigNumber { /** * The unscaled value of this decimal number. @@ -24,20 +23,22 @@ final class BigDecimal extends BigNumber * No leading zero must be present. * No leading minus sign must be present if the value is 0. */ - private readonly string $value; + private string $value; /** * The scale (number of digits after the decimal point) of this decimal number. * * This must be zero or more. */ - private readonly int $scale; + private int $scale; /** * Protected constructor. Use a factory method to obtain an instance. * * @param string $value The unscaled value, validated. * @param int $scale The scale, validated. + * + * @pure */ protected function __construct(string $value, int $scale = 0) { @@ -45,9 +46,6 @@ final class BigDecimal extends BigNumber $this->scale = $scale; } - /** - * @psalm-pure - */ #[Override] protected static function from(BigNumber $number): static { @@ -63,7 +61,7 @@ final class BigDecimal extends BigNumber * @param int $scale The scale of the number. If negative, the scale will be set to zero * and the unscaled value will be adjusted accordingly. * - * @psalm-pure + * @pure */ public static function ofUnscaledValue(BigNumber|int|float|string $value, int $scale = 0) : BigDecimal { @@ -82,14 +80,11 @@ final class BigDecimal extends BigNumber /** * Returns a BigDecimal representing zero, with a scale of zero. * - * @psalm-pure + * @pure */ public static function zero() : BigDecimal { - /** - * @psalm-suppress ImpureStaticVariable - * @var BigDecimal|null $zero - */ + /** @var BigDecimal|null $zero */ static $zero; if ($zero === null) { @@ -102,14 +97,11 @@ final class BigDecimal extends BigNumber /** * Returns a BigDecimal representing one, with a scale of zero. * - * @psalm-pure + * @pure */ public static function one() : BigDecimal { - /** - * @psalm-suppress ImpureStaticVariable - * @var BigDecimal|null $one - */ + /** @var BigDecimal|null $one */ static $one; if ($one === null) { @@ -122,14 +114,11 @@ final class BigDecimal extends BigNumber /** * Returns a BigDecimal representing ten, with a scale of zero. * - * @psalm-pure + * @pure */ public static function ten() : BigDecimal { - /** - * @psalm-suppress ImpureStaticVariable - * @var BigDecimal|null $ten - */ + /** @var BigDecimal|null $ten */ static $ten; if ($ten === null) { @@ -147,6 +136,8 @@ final class BigDecimal extends BigNumber * @param BigNumber|int|float|string $that The number to add. Must be convertible to a BigDecimal. * * @throws MathException If the number is not valid, or is not convertible to a BigDecimal. + * + * @pure */ public function plus(BigNumber|int|float|string $that) : BigDecimal { @@ -162,7 +153,7 @@ final class BigDecimal extends BigNumber [$a, $b] = $this->scaleValues($this, $that); - $value = Calculator::get()->add($a, $b); + $value = CalculatorRegistry::get()->add($a, $b); $scale = $this->scale > $that->scale ? $this->scale : $that->scale; return new BigDecimal($value, $scale); @@ -176,6 +167,8 @@ final class BigDecimal extends BigNumber * @param BigNumber|int|float|string $that The number to subtract. Must be convertible to a BigDecimal. * * @throws MathException If the number is not valid, or is not convertible to a BigDecimal. + * + * @pure */ public function minus(BigNumber|int|float|string $that) : BigDecimal { @@ -187,7 +180,7 @@ final class BigDecimal extends BigNumber [$a, $b] = $this->scaleValues($this, $that); - $value = Calculator::get()->sub($a, $b); + $value = CalculatorRegistry::get()->sub($a, $b); $scale = $this->scale > $that->scale ? $this->scale : $that->scale; return new BigDecimal($value, $scale); @@ -201,6 +194,8 @@ final class BigDecimal extends BigNumber * @param BigNumber|int|float|string $that The multiplier. Must be convertible to a BigDecimal. * * @throws MathException If the multiplier is not a valid number, or is not convertible to a BigDecimal. + * + * @pure */ public function multipliedBy(BigNumber|int|float|string $that) : BigDecimal { @@ -214,7 +209,7 @@ final class BigDecimal extends BigNumber return $that; } - $value = Calculator::get()->mul($this->value, $that->value); + $value = CalculatorRegistry::get()->mul($this->value, $that->value); $scale = $this->scale + $that->scale; return new BigDecimal($value, $scale); @@ -229,6 +224,8 @@ final class BigDecimal extends BigNumber * * @throws \InvalidArgumentException If the scale or rounding mode is invalid. * @throws MathException If the number is invalid, is zero, or rounding was necessary. + * + * @pure */ public function dividedBy(BigNumber|int|float|string $that, ?int $scale = null, RoundingMode $roundingMode = RoundingMode::UNNECESSARY) : BigDecimal { @@ -251,7 +248,7 @@ final class BigDecimal extends BigNumber $p = $this->valueWithMinScale($that->scale + $scale); $q = $that->valueWithMinScale($this->scale - $scale); - $result = Calculator::get()->divRound($p, $q, $roundingMode); + $result = CalculatorRegistry::get()->divRound($p, $q, $roundingMode); return new BigDecimal($result, $scale); } @@ -265,6 +262,8 @@ final class BigDecimal extends BigNumber * * @throws MathException If the divisor is not a valid number, is not convertible to a BigDecimal, is zero, * or the result yields an infinite number of digits. + * + * @pure */ public function exactlyDividedBy(BigNumber|int|float|string $that) : BigDecimal { @@ -279,7 +278,7 @@ final class BigDecimal extends BigNumber $d = \rtrim($b, '0'); $scale = \strlen($b) - \strlen($d); - $calculator = Calculator::get(); + $calculator = CalculatorRegistry::get(); foreach ([5, 2] as $prime) { for (;;) { @@ -297,12 +296,36 @@ final class BigDecimal extends BigNumber return $this->dividedBy($that, $scale)->stripTrailingZeros(); } + /** + * Limits (clamps) this number between the given minimum and maximum values. + * + * If the number is lower than $min, returns a copy of $min. + * If the number is greater than $max, returns a copy of $max. + * Otherwise, returns this number unchanged. + * + * @param BigNumber|int|float|string $min The minimum. Must be convertible to a BigDecimal. + * @param BigNumber|int|float|string $max The maximum. Must be convertible to a BigDecimal. + * + * @throws MathException If min/max are not convertible to a BigDecimal. + */ + public function clamp(BigNumber|int|float|string $min, BigNumber|int|float|string $max) : BigDecimal + { + if ($this->isLessThan($min)) { + return BigDecimal::of($min); + } elseif ($this->isGreaterThan($max)) { + return BigDecimal::of($max); + } + return $this; + } + /** * Returns this number exponentiated to the given value. * * The result has a scale of `$this->scale * $exponent`. * * @throws \InvalidArgumentException If the exponent is not in the range 0 to 1,000,000. + * + * @pure */ public function power(int $exponent) : BigDecimal { @@ -322,7 +345,7 @@ final class BigDecimal extends BigNumber )); } - return new BigDecimal(Calculator::get()->pow($this->value, $exponent), $this->scale * $exponent); + return new BigDecimal(CalculatorRegistry::get()->pow($this->value, $exponent), $this->scale * $exponent); } /** @@ -333,6 +356,8 @@ final class BigDecimal extends BigNumber * @param BigNumber|int|float|string $that The divisor. Must be convertible to a BigDecimal. * * @throws MathException If the divisor is not a valid decimal number, or is zero. + * + * @pure */ public function quotient(BigNumber|int|float|string $that) : BigDecimal { @@ -345,7 +370,7 @@ final class BigDecimal extends BigNumber $p = $this->valueWithMinScale($that->scale); $q = $that->valueWithMinScale($this->scale); - $quotient = Calculator::get()->divQ($p, $q); + $quotient = CalculatorRegistry::get()->divQ($p, $q); return new BigDecimal($quotient, 0); } @@ -358,6 +383,8 @@ final class BigDecimal extends BigNumber * @param BigNumber|int|float|string $that The divisor. Must be convertible to a BigDecimal. * * @throws MathException If the divisor is not a valid decimal number, or is zero. + * + * @pure */ public function remainder(BigNumber|int|float|string $that) : BigDecimal { @@ -370,7 +397,7 @@ final class BigDecimal extends BigNumber $p = $this->valueWithMinScale($that->scale); $q = $that->valueWithMinScale($this->scale); - $remainder = Calculator::get()->divR($p, $q); + $remainder = CalculatorRegistry::get()->divR($p, $q); $scale = $this->scale > $that->scale ? $this->scale : $that->scale; @@ -384,11 +411,11 @@ final class BigDecimal extends BigNumber * * @param BigNumber|int|float|string $that The divisor. Must be convertible to a BigDecimal. * - * @return BigDecimal[] An array containing the quotient and the remainder. - * - * @psalm-return array{BigDecimal, BigDecimal} + * @return array{BigDecimal, BigDecimal} An array containing the quotient and the remainder. * * @throws MathException If the divisor is not a valid decimal number, or is zero. + * + * @pure */ public function quotientAndRemainder(BigNumber|int|float|string $that) : array { @@ -401,7 +428,7 @@ final class BigDecimal extends BigNumber $p = $this->valueWithMinScale($that->scale); $q = $that->valueWithMinScale($this->scale); - [$quotient, $remainder] = Calculator::get()->divQR($p, $q); + [$quotient, $remainder] = CalculatorRegistry::get()->divQR($p, $q); $scale = $this->scale > $that->scale ? $this->scale : $that->scale; @@ -416,6 +443,8 @@ final class BigDecimal extends BigNumber * * @throws \InvalidArgumentException If the scale is negative. * @throws NegativeNumberException If this number is negative. + * + * @pure */ public function sqrt(int $scale) : BigDecimal { @@ -447,13 +476,15 @@ final class BigDecimal extends BigNumber $value = \substr($value, 0, $addDigits); } - $value = Calculator::get()->sqrt($value); + $value = CalculatorRegistry::get()->sqrt($value); return new BigDecimal($value, $scale); } /** * Returns a copy of this BigDecimal with the decimal point moved $n places to the left. + * + * @pure */ public function withPointMovedLeft(int $n) : BigDecimal { @@ -470,6 +501,8 @@ final class BigDecimal extends BigNumber /** * Returns a copy of this BigDecimal with the decimal point moved $n places to the right. + * + * @pure */ public function withPointMovedRight(int $n) : BigDecimal { @@ -496,6 +529,8 @@ final class BigDecimal extends BigNumber /** * Returns a copy of this BigDecimal with any trailing zeros removed from the fractional part. + * + * @pure */ public function stripTrailingZeros() : BigDecimal { @@ -527,6 +562,8 @@ final class BigDecimal extends BigNumber /** * Returns the absolute value of this number. + * + * @pure */ public function abs() : BigDecimal { @@ -535,10 +572,12 @@ final class BigDecimal extends BigNumber /** * Returns the negated value of this number. + * + * @pure */ public function negated() : BigDecimal { - return new BigDecimal(Calculator::get()->neg($this->value), $this->scale); + return new BigDecimal(CalculatorRegistry::get()->neg($this->value), $this->scale); } #[Override] @@ -553,7 +592,7 @@ final class BigDecimal extends BigNumber if ($that instanceof BigDecimal) { [$a, $b] = $this->scaleValues($this, $that); - return Calculator::get()->cmp($a, $b); + return CalculatorRegistry::get()->cmp($a, $b); } return - $that->compareTo($this); @@ -565,11 +604,17 @@ final class BigDecimal extends BigNumber return ($this->value === '0') ? 0 : (($this->value[0] === '-') ? -1 : 1); } + /** + * @pure + */ public function getUnscaledValue() : BigInteger { return self::newBigInteger($this->value); } + /** + * @pure + */ public function getScale() : int { return $this->scale; @@ -588,6 +633,8 @@ final class BigDecimal extends BigNumber * 123.456 => 6 * 0.00123 => 3 * 0.0012300 => 5 + * + * @pure */ public function getPrecision(): int { @@ -606,6 +653,8 @@ final class BigDecimal extends BigNumber * Returns a string representing the integral part of this decimal number. * * Example: `-123.456` => `-123`. + * + * @pure */ public function getIntegralPart() : string { @@ -624,6 +673,8 @@ final class BigDecimal extends BigNumber * If the scale is zero, an empty string is returned. * * Examples: `-123.456` => '456', `123` => ''. + * + * @pure */ public function getFractionalPart() : string { @@ -638,6 +689,8 @@ final class BigDecimal extends BigNumber /** * Returns whether this decimal number has a non-zero fractional part. + * + * @pure */ public function hasNonZeroFractionalPart() : bool { @@ -702,7 +755,7 @@ final class BigDecimal extends BigNumber $value = $this->getUnscaledValueWithLeadingZeros(); - /** @var numeric-string */ + /** @phpstan-ignore return.type */ return \substr($value, 0, -$this->scale) . '.' . \substr($value, -$this->scale); } @@ -722,7 +775,6 @@ final class BigDecimal extends BigNumber * This method is only here to allow unserializing the object and cannot be accessed directly. * * @internal - * @psalm-suppress RedundantPropertyInitializationCheck * * @param array{value: string, scale: int} $data * @@ -730,10 +782,12 @@ final class BigDecimal extends BigNumber */ public function __unserialize(array $data): void { + /** @phpstan-ignore isset.initializedProperty */ if (isset($this->value)) { throw new \LogicException('__unserialize() is an internal function, it must not be called directly.'); } + /** @phpstan-ignore deadCode.unreachable */ $this->value = $data['value']; $this->scale = $data['scale']; } @@ -742,6 +796,8 @@ final class BigDecimal extends BigNumber * Puts the internal values of the given decimal numbers on the same scale. * * @return array{string, string} The scaled integer values of $x and $y. + * + * @pure */ private function scaleValues(BigDecimal $x, BigDecimal $y) : array { @@ -757,6 +813,9 @@ final class BigDecimal extends BigNumber return [$a, $b]; } + /** + * @pure + */ private function valueWithMinScale(int $scale) : string { $value = $this->value; @@ -770,6 +829,8 @@ final class BigDecimal extends BigNumber /** * Adds leading zeros if necessary to the unscaled value to represent the full decimal number. + * + * @pure */ private function getUnscaledValueWithLeadingZeros() : string { diff --git a/vendor/brick/math/src/BigInteger.php b/vendor/brick/math/src/BigInteger.php index 6ede65e..48a7bb3 100644 --- a/vendor/brick/math/src/BigInteger.php +++ b/vendor/brick/math/src/BigInteger.php @@ -10,6 +10,7 @@ use Brick\Math\Exception\MathException; use Brick\Math\Exception\NegativeNumberException; use Brick\Math\Exception\NumberFormatException; use Brick\Math\Internal\Calculator; +use Brick\Math\Internal\CalculatorRegistry; use Override; /** @@ -17,10 +18,8 @@ use Override; * * All methods accepting a number as a parameter accept either a BigInteger instance, * an integer, or a string representing an arbitrary size integer. - * - * @psalm-immutable */ -final class BigInteger extends BigNumber +final readonly class BigInteger extends BigNumber { /** * The value, as a string of digits with optional leading minus sign. @@ -28,21 +27,20 @@ final class BigInteger extends BigNumber * No leading zeros must be present. * No leading minus sign must be present if the number is zero. */ - private readonly string $value; + private string $value; /** * Protected constructor. Use a factory method to obtain an instance. * * @param string $value A string of digits, with optional leading minus sign. + * + * @pure */ protected function __construct(string $value) { $this->value = $value; } - /** - * @psalm-pure - */ #[Override] protected static function from(BigNumber $number): static { @@ -66,7 +64,7 @@ final class BigInteger extends BigNumber * @throws NumberFormatException If the number is empty, or contains invalid chars for the given base. * @throws \InvalidArgumentException If the base is out of range. * - * @psalm-pure + * @pure */ public static function fromBase(string $number, int $base) : BigInteger { @@ -115,7 +113,7 @@ final class BigInteger extends BigNumber return new BigInteger($sign . $number); } - $result = Calculator::get()->fromBase($number, $base); + $result = CalculatorRegistry::get()->fromBase($number, $base); return new BigInteger($sign . $result); } @@ -131,7 +129,7 @@ final class BigInteger extends BigNumber * @throws NumberFormatException If the given number is empty or contains invalid chars for the given alphabet. * @throws \InvalidArgumentException If the alphabet does not contain at least 2 chars. * - * @psalm-pure + * @pure */ public static function fromArbitraryBase(string $number, string $alphabet) : BigInteger { @@ -151,7 +149,7 @@ final class BigInteger extends BigNumber throw NumberFormatException::charNotInAlphabet($matches[0]); } - $number = Calculator::get()->fromArbitraryBase($number, $alphabet, $base); + $number = CalculatorRegistry::get()->fromArbitraryBase($number, $alphabet, $base); return new BigInteger($number); } @@ -172,6 +170,8 @@ final class BigInteger extends BigNumber * sign bit. * * @throws NumberFormatException If the string is empty. + * + * @pure */ public static function fromBytes(string $value, bool $signed = true) : BigInteger { @@ -203,12 +203,10 @@ final class BigInteger extends BigNumber * * Using the default random bytes generator, this method is suitable for cryptographic use. * - * @psalm-param (callable(int): string)|null $randomBytesGenerator - * - * @param int $numBits The number of bits. - * @param callable|null $randomBytesGenerator A function that accepts a number of bytes as an integer, and returns a - * string of random bytes of the given length. Defaults to the - * `random_bytes()` function. + * @param int $numBits The number of bits. + * @param (callable(int): string)|null $randomBytesGenerator A function that accepts a number of bytes, and returns + * a string of random bytes of the given length. Defaults + * to the `random_bytes()` function. * * @throws \InvalidArgumentException If $numBits is negative. */ @@ -243,13 +241,11 @@ final class BigInteger extends BigNumber * * Using the default random bytes generator, this method is suitable for cryptographic use. * - * @psalm-param (callable(int): string)|null $randomBytesGenerator - * - * @param BigNumber|int|float|string $min The lower bound. Must be convertible to a BigInteger. - * @param BigNumber|int|float|string $max The upper bound. Must be convertible to a BigInteger. - * @param callable|null $randomBytesGenerator A function that accepts a number of bytes as an integer, - * and returns a string of random bytes of the given length. - * Defaults to the `random_bytes()` function. + * @param BigNumber|int|float|string $min The lower bound. Must be convertible to a BigInteger. + * @param BigNumber|int|float|string $max The upper bound. Must be convertible to a BigInteger. + * @param (callable(int): string)|null $randomBytesGenerator A function that accepts a number of bytes, and returns + * a string of random bytes of the given length. Defaults + * to the `random_bytes()` function. * * @throws MathException If one of the parameters cannot be converted to a BigInteger, * or `$min` is greater than `$max`. @@ -284,14 +280,11 @@ final class BigInteger extends BigNumber /** * Returns a BigInteger representing zero. * - * @psalm-pure + * @pure */ public static function zero() : BigInteger { - /** - * @psalm-suppress ImpureStaticVariable - * @var BigInteger|null $zero - */ + /** @var BigInteger|null $zero */ static $zero; if ($zero === null) { @@ -304,14 +297,11 @@ final class BigInteger extends BigNumber /** * Returns a BigInteger representing one. * - * @psalm-pure + * @pure */ public static function one() : BigInteger { - /** - * @psalm-suppress ImpureStaticVariable - * @var BigInteger|null $one - */ + /** @var BigInteger|null $one */ static $one; if ($one === null) { @@ -324,14 +314,11 @@ final class BigInteger extends BigNumber /** * Returns a BigInteger representing ten. * - * @psalm-pure + * @pure */ public static function ten() : BigInteger { - /** - * @psalm-suppress ImpureStaticVariable - * @var BigInteger|null $ten - */ + /** @var BigInteger|null $ten */ static $ten; if ($ten === null) { @@ -341,6 +328,9 @@ final class BigInteger extends BigNumber return $ten; } + /** + * @pure + */ public static function gcdMultiple(BigInteger $a, BigInteger ...$n): BigInteger { $result = $a; @@ -362,6 +352,8 @@ final class BigInteger extends BigNumber * @param BigNumber|int|float|string $that The number to add. Must be convertible to a BigInteger. * * @throws MathException If the number is not valid, or is not convertible to a BigInteger. + * + * @pure */ public function plus(BigNumber|int|float|string $that) : BigInteger { @@ -375,7 +367,7 @@ final class BigInteger extends BigNumber return $that; } - $value = Calculator::get()->add($this->value, $that->value); + $value = CalculatorRegistry::get()->add($this->value, $that->value); return new BigInteger($value); } @@ -386,6 +378,8 @@ final class BigInteger extends BigNumber * @param BigNumber|int|float|string $that The number to subtract. Must be convertible to a BigInteger. * * @throws MathException If the number is not valid, or is not convertible to a BigInteger. + * + * @pure */ public function minus(BigNumber|int|float|string $that) : BigInteger { @@ -395,7 +389,7 @@ final class BigInteger extends BigNumber return $this; } - $value = Calculator::get()->sub($this->value, $that->value); + $value = CalculatorRegistry::get()->sub($this->value, $that->value); return new BigInteger($value); } @@ -406,6 +400,8 @@ final class BigInteger extends BigNumber * @param BigNumber|int|float|string $that The multiplier. Must be convertible to a BigInteger. * * @throws MathException If the multiplier is not a valid number, or is not convertible to a BigInteger. + * + * @pure */ public function multipliedBy(BigNumber|int|float|string $that) : BigInteger { @@ -419,7 +415,7 @@ final class BigInteger extends BigNumber return $that; } - $value = Calculator::get()->mul($this->value, $that->value); + $value = CalculatorRegistry::get()->mul($this->value, $that->value); return new BigInteger($value); } @@ -432,6 +428,8 @@ final class BigInteger extends BigNumber * * @throws MathException If the divisor is not a valid number, is not convertible to a BigInteger, is zero, * or RoundingMode::UNNECESSARY is used and the remainder is not zero. + * + * @pure */ public function dividedBy(BigNumber|int|float|string $that, RoundingMode $roundingMode = RoundingMode::UNNECESSARY) : BigInteger { @@ -445,15 +443,40 @@ final class BigInteger extends BigNumber throw DivisionByZeroException::divisionByZero(); } - $result = Calculator::get()->divRound($this->value, $that->value, $roundingMode); + $result = CalculatorRegistry::get()->divRound($this->value, $that->value, $roundingMode); return new BigInteger($result); } + /** + * Limits (clamps) this number between the given minimum and maximum values. + * + * If the number is lower than $min, returns a copy of $min. + * If the number is greater than $max, returns a copy of $max. + * Otherwise, returns this number unchanged. + * + * @param BigNumber|int|float|string $min The minimum. Must be convertible to a BigInteger. + * @param BigNumber|int|float|string $max The maximum. Must be convertible to a BigInteger. + * + * @throws MathException If min/max are not convertible to a BigInteger. + */ + public function clamp(BigNumber|int|float|string $min, BigNumber|int|float|string $max) : BigInteger + { + if ($this->isLessThan($min)) { + return BigInteger::of($min); + } elseif ($this->isGreaterThan($max)) { + return BigInteger::of($max); + } + return $this; + } + + /** * Returns this number exponentiated to the given value. * * @throws \InvalidArgumentException If the exponent is not in the range 0 to 1,000,000. + * + * @pure */ public function power(int $exponent) : BigInteger { @@ -473,7 +496,7 @@ final class BigInteger extends BigNumber )); } - return new BigInteger(Calculator::get()->pow($this->value, $exponent)); + return new BigInteger(CalculatorRegistry::get()->pow($this->value, $exponent)); } /** @@ -482,6 +505,8 @@ final class BigInteger extends BigNumber * @param BigNumber|int|float|string $that The divisor. Must be convertible to a BigInteger. * * @throws DivisionByZeroException If the divisor is zero. + * + * @pure */ public function quotient(BigNumber|int|float|string $that) : BigInteger { @@ -495,7 +520,7 @@ final class BigInteger extends BigNumber throw DivisionByZeroException::divisionByZero(); } - $quotient = Calculator::get()->divQ($this->value, $that->value); + $quotient = CalculatorRegistry::get()->divQ($this->value, $that->value); return new BigInteger($quotient); } @@ -508,6 +533,8 @@ final class BigInteger extends BigNumber * @param BigNumber|int|float|string $that The divisor. Must be convertible to a BigInteger. * * @throws DivisionByZeroException If the divisor is zero. + * + * @pure */ public function remainder(BigNumber|int|float|string $that) : BigInteger { @@ -521,7 +548,7 @@ final class BigInteger extends BigNumber throw DivisionByZeroException::divisionByZero(); } - $remainder = Calculator::get()->divR($this->value, $that->value); + $remainder = CalculatorRegistry::get()->divR($this->value, $that->value); return new BigInteger($remainder); } @@ -531,11 +558,11 @@ final class BigInteger extends BigNumber * * @param BigNumber|int|float|string $that The divisor. Must be convertible to a BigInteger. * - * @return BigInteger[] An array containing the quotient and the remainder. - * - * @psalm-return array{BigInteger, BigInteger} + * @return array{BigInteger, BigInteger} An array containing the quotient and the remainder. * * @throws DivisionByZeroException If the divisor is zero. + * + * @pure */ public function quotientAndRemainder(BigNumber|int|float|string $that) : array { @@ -545,7 +572,7 @@ final class BigInteger extends BigNumber throw DivisionByZeroException::divisionByZero(); } - [$quotient, $remainder] = Calculator::get()->divQR($this->value, $that->value); + [$quotient, $remainder] = CalculatorRegistry::get()->divQR($this->value, $that->value); return [ new BigInteger($quotient), @@ -564,6 +591,8 @@ final class BigInteger extends BigNumber * @param BigNumber|int|float|string $that The divisor. Must be convertible to a BigInteger. * * @throws DivisionByZeroException If the divisor is zero. + * + * @pure */ public function mod(BigNumber|int|float|string $that) : BigInteger { @@ -573,7 +602,7 @@ final class BigInteger extends BigNumber throw DivisionByZeroException::modulusMustNotBeZero(); } - $value = Calculator::get()->mod($this->value, $that->value); + $value = CalculatorRegistry::get()->mod($this->value, $that->value); return new BigInteger($value); } @@ -585,6 +614,8 @@ final class BigInteger extends BigNumber * @throws NegativeNumberException If $m is negative. * @throws MathException If this BigInteger has no multiplicative inverse mod m (that is, this BigInteger * is not relatively prime to m). + * + * @pure */ public function modInverse(BigInteger $m) : BigInteger { @@ -600,7 +631,7 @@ final class BigInteger extends BigNumber return BigInteger::zero(); } - $value = Calculator::get()->modInverse($this->value, $m->value); + $value = CalculatorRegistry::get()->modInverse($this->value, $m->value); if ($value === null) { throw new MathException('Unable to compute the modInverse for the given modulus.'); @@ -619,6 +650,8 @@ final class BigInteger extends BigNumber * * @throws NegativeNumberException If any of the operands is negative. * @throws DivisionByZeroException If the modulus is zero. + * + * @pure */ public function modPow(BigNumber|int|float|string $exp, BigNumber|int|float|string $mod) : BigInteger { @@ -633,7 +666,7 @@ final class BigInteger extends BigNumber throw DivisionByZeroException::modulusMustNotBeZero(); } - $result = Calculator::get()->modPow($this->value, $exp->value, $mod->value); + $result = CalculatorRegistry::get()->modPow($this->value, $exp->value, $mod->value); return new BigInteger($result); } @@ -644,6 +677,8 @@ final class BigInteger extends BigNumber * The GCD is always positive, unless both operands are zero, in which case it is zero. * * @param BigNumber|int|float|string $that The operand. Must be convertible to an integer number. + * + * @pure */ public function gcd(BigNumber|int|float|string $that) : BigInteger { @@ -657,7 +692,7 @@ final class BigInteger extends BigNumber return $that; } - $value = Calculator::get()->gcd($this->value, $that->value); + $value = CalculatorRegistry::get()->gcd($this->value, $that->value); return new BigInteger($value); } @@ -668,6 +703,8 @@ final class BigInteger extends BigNumber * The result is the largest x such that x² ≤ n. * * @throws NegativeNumberException If this number is negative. + * + * @pure */ public function sqrt() : BigInteger { @@ -675,13 +712,15 @@ final class BigInteger extends BigNumber throw new NegativeNumberException('Cannot calculate the square root of a negative number.'); } - $value = Calculator::get()->sqrt($this->value); + $value = CalculatorRegistry::get()->sqrt($this->value); return new BigInteger($value); } /** * Returns the absolute value of this number. + * + * @pure */ public function abs() : BigInteger { @@ -690,10 +729,12 @@ final class BigInteger extends BigNumber /** * Returns the inverse of this number. + * + * @pure */ public function negated() : BigInteger { - return new BigInteger(Calculator::get()->neg($this->value)); + return new BigInteger(CalculatorRegistry::get()->neg($this->value)); } /** @@ -702,12 +743,14 @@ final class BigInteger extends BigNumber * This method returns a negative BigInteger if and only if both operands are negative. * * @param BigNumber|int|float|string $that The operand. Must be convertible to an integer number. + * + * @pure */ public function and(BigNumber|int|float|string $that) : BigInteger { $that = BigInteger::of($that); - return new BigInteger(Calculator::get()->and($this->value, $that->value)); + return new BigInteger(CalculatorRegistry::get()->and($this->value, $that->value)); } /** @@ -716,12 +759,14 @@ final class BigInteger extends BigNumber * This method returns a negative BigInteger if and only if either of the operands is negative. * * @param BigNumber|int|float|string $that The operand. Must be convertible to an integer number. + * + * @pure */ public function or(BigNumber|int|float|string $that) : BigInteger { $that = BigInteger::of($that); - return new BigInteger(Calculator::get()->or($this->value, $that->value)); + return new BigInteger(CalculatorRegistry::get()->or($this->value, $that->value)); } /** @@ -730,16 +775,20 @@ final class BigInteger extends BigNumber * This method returns a negative BigInteger if and only if exactly one of the operands is negative. * * @param BigNumber|int|float|string $that The operand. Must be convertible to an integer number. + * + * @pure */ public function xor(BigNumber|int|float|string $that) : BigInteger { $that = BigInteger::of($that); - return new BigInteger(Calculator::get()->xor($this->value, $that->value)); + return new BigInteger(CalculatorRegistry::get()->xor($this->value, $that->value)); } /** * Returns the bitwise-not of this BigInteger. + * + * @pure */ public function not() : BigInteger { @@ -748,6 +797,8 @@ final class BigInteger extends BigNumber /** * Returns the integer left shifted by a given number of bits. + * + * @pure */ public function shiftedLeft(int $distance) : BigInteger { @@ -764,6 +815,8 @@ final class BigInteger extends BigNumber /** * Returns the integer right shifted by a given number of bits. + * + * @pure */ public function shiftedRight(int $distance) : BigInteger { @@ -789,6 +842,8 @@ final class BigInteger extends BigNumber * * For positive BigIntegers, this is equivalent to the number of bits in the ordinary binary representation. * Computes (ceil(log2(this < 0 ? -this : this+1))). + * + * @pure */ public function getBitLength() : int { @@ -807,6 +862,8 @@ final class BigInteger extends BigNumber * Returns the index of the rightmost (lowest-order) one bit in this BigInteger. * * Returns -1 if this BigInteger contains no one bits. + * + * @pure */ public function getLowestSetBit() : int { @@ -826,6 +883,8 @@ final class BigInteger extends BigNumber /** * Returns whether this number is even. + * + * @pure */ public function isEven() : bool { @@ -834,6 +893,8 @@ final class BigInteger extends BigNumber /** * Returns whether this number is odd. + * + * @pure */ public function isOdd() : bool { @@ -848,6 +909,8 @@ final class BigInteger extends BigNumber * @param int $n The bit to test, 0-based. * * @throws \InvalidArgumentException If the bit to test is negative. + * + * @pure */ public function testBit(int $n) : bool { @@ -864,7 +927,7 @@ final class BigInteger extends BigNumber $that = BigNumber::of($that); if ($that instanceof BigInteger) { - return Calculator::get()->cmp($this->value, $that->value); + return CalculatorRegistry::get()->cmp($this->value, $that->value); } return - $that->compareTo($this); @@ -924,6 +987,8 @@ final class BigInteger extends BigNumber * The output will always be lowercase for bases greater than 10. * * @throws \InvalidArgumentException If the base is out of range. + * + * @pure */ public function toBase(int $base) : string { @@ -935,7 +1000,7 @@ final class BigInteger extends BigNumber throw new \InvalidArgumentException(\sprintf('Base %d is out of range [2, 36]', $base)); } - return Calculator::get()->toBase($this->value, $base); + return CalculatorRegistry::get()->toBase($this->value, $base); } /** @@ -948,6 +1013,8 @@ final class BigInteger extends BigNumber * * @throws NegativeNumberException If this number is negative. * @throws \InvalidArgumentException If the given alphabet does not contain at least 2 chars. + * + * @pure */ public function toArbitraryBase(string $alphabet) : string { @@ -961,7 +1028,7 @@ final class BigInteger extends BigNumber throw new NegativeNumberException(__FUNCTION__ . '() does not support negative numbers.'); } - return Calculator::get()->toArbitraryBase($this->value, $alphabet, $base); + return CalculatorRegistry::get()->toArbitraryBase($this->value, $alphabet, $base); } /** @@ -981,6 +1048,8 @@ final class BigInteger extends BigNumber * @param bool $signed Whether to output a signed number in two's-complement representation with a leading sign bit. * * @throws NegativeNumberException If $signed is false, and the number is negative. + * + * @pure */ public function toBytes(bool $signed = true) : string { @@ -1020,7 +1089,10 @@ final class BigInteger extends BigNumber } } - return \hex2bin($hex); + $result = \hex2bin($hex); + assert($result !== false); + + return $result; } /** @@ -1049,7 +1121,6 @@ final class BigInteger extends BigNumber * This method is only here to allow unserializing the object and cannot be accessed directly. * * @internal - * @psalm-suppress RedundantPropertyInitializationCheck * * @param array{value: string} $data * @@ -1057,10 +1128,12 @@ final class BigInteger extends BigNumber */ public function __unserialize(array $data): void { + /** @phpstan-ignore isset.initializedProperty */ if (isset($this->value)) { throw new \LogicException('__unserialize() is an internal function, it must not be called directly.'); } + /** @phpstan-ignore deadCode.unreachable */ $this->value = $data['value']; } } diff --git a/vendor/brick/math/src/BigNumber.php b/vendor/brick/math/src/BigNumber.php index 5dabd31..2fbdf69 100644 --- a/vendor/brick/math/src/BigNumber.php +++ b/vendor/brick/math/src/BigNumber.php @@ -11,11 +11,14 @@ use Brick\Math\Exception\RoundingNecessaryException; use Override; /** - * Common interface for arbitrary-precision rational numbers. + * Base class for arbitrary-precision numbers. * - * @psalm-immutable + * This class is sealed: it is part of the public API but should not be subclassed in userland. + * Protected methods may change in any version. + * + * @phpstan-sealed BigInteger|BigDecimal|BigRational */ -abstract class BigNumber implements \JsonSerializable +abstract readonly class BigNumber implements \JsonSerializable, \Stringable { /** * The regular expression used to parse integer or decimal numbers. @@ -43,7 +46,8 @@ abstract class BigNumber implements \JsonSerializable /** * Creates a BigNumber of the given value. * - * The concrete return type is dependent on the given value, with the following rules: + * When of() is called on BigNumber, the concrete return type is dependent on the given value, with the following + * rules: * * - BigNumber instances are returned as is * - integer numbers are returned as BigInteger @@ -52,18 +56,20 @@ abstract class BigNumber implements \JsonSerializable * - strings containing a `.` character or using an exponential notation are returned as BigDecimal * - strings containing only digits with an optional leading `+` or `-` sign are returned as BigInteger * + * When of() is called on BigInteger, BigDecimal, or BigRational, the resulting number is converted to an instance + * of the subclass when possible; otherwise a RoundingNecessaryException exception is thrown. + * * @throws NumberFormatException If the format of the number is not valid. * @throws DivisionByZeroException If the value represents a rational number with a denominator of zero. * @throws RoundingNecessaryException If the value cannot be converted to an instance of the subclass without rounding. * - * @psalm-pure + * @pure */ final public static function of(BigNumber|int|float|string $value) : static { $value = self::_of($value); if (static::class === BigNumber::class) { - // https://github.com/vimeo/psalm/issues/10309 assert($value instanceof static); return $value; @@ -76,7 +82,7 @@ abstract class BigNumber implements \JsonSerializable * @throws NumberFormatException If the format of the number is not valid. * @throws DivisionByZeroException If the value represents a rational number with a denominator of zero. * - * @psalm-pure + * @pure */ private static function _of(BigNumber|int|float|string $value) : BigNumber { @@ -102,9 +108,6 @@ abstract class BigNumber implements \JsonSerializable $numerator = $matches['numerator']; $denominator = $matches['denominator']; - assert($numerator !== null); - assert($denominator !== null); - $numerator = self::cleanUp($sign, $numerator); $denominator = self::cleanUp(null, $denominator); @@ -138,7 +141,7 @@ abstract class BigNumber implements \JsonSerializable } if ($point !== null || $exponent !== null) { - $fractional = ($fractional ?? ''); + $fractional ??= ''; $exponent = ($exponent !== null) ? (int)$exponent : 0; if ($exponent === PHP_INT_MIN || $exponent === PHP_INT_MAX) { @@ -170,15 +173,15 @@ abstract class BigNumber implements \JsonSerializable * * @throws RoundingNecessaryException If the value cannot be converted. * - * @psalm-pure + * @pure */ abstract protected static function from(BigNumber $number): static; /** * Proxy method to access BigInteger's protected constructor from sibling classes. * + * @pure * @internal - * @psalm-pure */ final protected function newBigInteger(string $value) : BigInteger { @@ -188,8 +191,8 @@ abstract class BigNumber implements \JsonSerializable /** * Proxy method to access BigDecimal's protected constructor from sibling classes. * + * @pure * @internal - * @psalm-pure */ final protected function newBigDecimal(string $value, int $scale = 0) : BigDecimal { @@ -199,8 +202,8 @@ abstract class BigNumber implements \JsonSerializable /** * Proxy method to access BigRational's protected constructor from sibling classes. * + * @pure * @internal - * @psalm-pure */ final protected function newBigRational(BigInteger $numerator, BigInteger $denominator, bool $checkDenominator) : BigRational { @@ -216,7 +219,7 @@ abstract class BigNumber implements \JsonSerializable * @throws \InvalidArgumentException If no values are given. * @throws MathException If an argument is not valid. * - * @psalm-pure + * @pure */ final public static function min(BigNumber|int|float|string ...$values) : static { @@ -246,7 +249,7 @@ abstract class BigNumber implements \JsonSerializable * @throws \InvalidArgumentException If no values are given. * @throws MathException If an argument is not valid. * - * @psalm-pure + * @pure */ final public static function max(BigNumber|int|float|string ...$values) : static { @@ -270,41 +273,43 @@ abstract class BigNumber implements \JsonSerializable /** * Returns the sum of the given values. * - * @param BigNumber|int|float|string ...$values The numbers to add. All the numbers need to be convertible - * to an instance of the class this method is called on. + * When called on BigNumber, sum() accepts any supported type and returns a result whose type is the widest among + * the given values (BigInteger < BigDecimal < BigRational). + * + * When called on BigInteger, BigDecimal, or BigRational, sum() requires that all values can be converted to that + * specific subclass, and returns a result of the same type. + * + * @param BigNumber|int|float|string ...$values The values to add. All values must be convertible to the class on + * which this method is called. * * @throws \InvalidArgumentException If no values are given. * @throws MathException If an argument is not valid. * - * @psalm-pure + * @pure */ final public static function sum(BigNumber|int|float|string ...$values) : static { - /** @var static|null $sum */ - $sum = null; + $first = array_shift($values); - foreach ($values as $value) { - $value = static::of($value); - - $sum = $sum === null ? $value : self::add($sum, $value); - } - - if ($sum === null) { + if ($first === null) { throw new \InvalidArgumentException(__METHOD__ . '() expects at least one value.'); } + $sum = static::of($first); + + foreach ($values as $value) { + $sum = self::add($sum, static::of($value)); + } + + assert($sum instanceof static); + return $sum; } /** * Adds two BigNumber instances in the correct order to avoid a RoundingNecessaryException. * - * @todo This could be better resolved by creating an abstract protected method in BigNumber, and leaving to - * concrete classes the responsibility to perform the addition themselves or delegate it to the given number, - * depending on their ability to perform the operation. This will also require a version bump because we're - * potentially breaking custom BigNumber implementations (if any...) - * - * @psalm-pure + * @pure */ private static function add(BigNumber $a, BigNumber $b) : BigNumber { @@ -324,8 +329,6 @@ abstract class BigNumber implements \JsonSerializable return $b->plus($a); } - /** @var BigInteger $a */ - return $a->plus($b); } @@ -333,9 +336,9 @@ abstract class BigNumber implements \JsonSerializable * Removes optional leading zeros and applies sign. * * @param string|null $sign The sign, '+' or '-', optional. Null is allowed for convenience and treated as '+'. - * @param string $number The number, validated as a non-empty string of digits. + * @param string $number The number, validated as a string of digits. * - * @psalm-pure + * @pure */ private static function cleanUp(string|null $sign, string $number) : string { @@ -350,6 +353,8 @@ abstract class BigNumber implements \JsonSerializable /** * Checks if this number is equal to the given one. + * + * @pure */ final public function isEqualTo(BigNumber|int|float|string $that) : bool { @@ -358,6 +363,8 @@ abstract class BigNumber implements \JsonSerializable /** * Checks if this number is strictly lower than the given one. + * + * @pure */ final public function isLessThan(BigNumber|int|float|string $that) : bool { @@ -366,6 +373,8 @@ abstract class BigNumber implements \JsonSerializable /** * Checks if this number is lower than or equal to the given one. + * + * @pure */ final public function isLessThanOrEqualTo(BigNumber|int|float|string $that) : bool { @@ -374,6 +383,8 @@ abstract class BigNumber implements \JsonSerializable /** * Checks if this number is strictly greater than the given one. + * + * @pure */ final public function isGreaterThan(BigNumber|int|float|string $that) : bool { @@ -382,6 +393,8 @@ abstract class BigNumber implements \JsonSerializable /** * Checks if this number is greater than or equal to the given one. + * + * @pure */ final public function isGreaterThanOrEqualTo(BigNumber|int|float|string $that) : bool { @@ -390,6 +403,8 @@ abstract class BigNumber implements \JsonSerializable /** * Checks if this number equals zero. + * + * @pure */ final public function isZero() : bool { @@ -398,6 +413,8 @@ abstract class BigNumber implements \JsonSerializable /** * Checks if this number is strictly negative. + * + * @pure */ final public function isNegative() : bool { @@ -406,6 +423,8 @@ abstract class BigNumber implements \JsonSerializable /** * Checks if this number is negative or zero. + * + * @pure */ final public function isNegativeOrZero() : bool { @@ -414,6 +433,8 @@ abstract class BigNumber implements \JsonSerializable /** * Checks if this number is strictly positive. + * + * @pure */ final public function isPositive() : bool { @@ -422,6 +443,8 @@ abstract class BigNumber implements \JsonSerializable /** * Checks if this number is positive or zero. + * + * @pure */ final public function isPositiveOrZero() : bool { @@ -431,20 +454,24 @@ abstract class BigNumber implements \JsonSerializable /** * Returns the sign of this number. * - * @psalm-return -1|0|1 + * Returns -1 if the number is negative, 0 if zero, 1 if positive. * - * @return int -1 if the number is negative, 0 if zero, 1 if positive. + * @return -1|0|1 + * + * @pure */ abstract public function getSign() : int; /** * Compares this number to the given one. * - * @psalm-return -1|0|1 + * Returns -1 if `$this` is lower than, 0 if equal to, 1 if greater than `$that`. * - * @return int -1 if `$this` is lower than, 0 if equal to, 1 if greater than `$that`. + * @return -1|0|1 * * @throws MathException If the number is not valid. + * + * @pure */ abstract public function compareTo(BigNumber|int|float|string $that) : int; @@ -452,6 +479,8 @@ abstract class BigNumber implements \JsonSerializable * Converts this number to a BigInteger. * * @throws RoundingNecessaryException If this number cannot be converted to a BigInteger without rounding. + * + * @pure */ abstract public function toBigInteger() : BigInteger; @@ -459,11 +488,15 @@ abstract class BigNumber implements \JsonSerializable * Converts this number to a BigDecimal. * * @throws RoundingNecessaryException If this number cannot be converted to a BigDecimal without rounding. + * + * @pure */ abstract public function toBigDecimal() : BigDecimal; /** * Converts this number to a BigRational. + * + * @pure */ abstract public function toBigRational() : BigRational; @@ -475,6 +508,8 @@ abstract class BigNumber implements \JsonSerializable * * @throws RoundingNecessaryException If this number cannot be converted to the given scale without rounding. * This only applies when RoundingMode::UNNECESSARY is used. + * + * @pure */ abstract public function toScale(int $scale, RoundingMode $roundingMode = RoundingMode::UNNECESSARY) : BigDecimal; @@ -485,6 +520,8 @@ abstract class BigNumber implements \JsonSerializable * Note that the acceptable range for an integer depends on the platform and differs for 32-bit and 64-bit. * * @throws MathException If this number cannot be exactly converted to a native integer. + * + * @pure */ abstract public function toInt() : int; @@ -496,6 +533,8 @@ abstract class BigNumber implements \JsonSerializable * * If the number is greater than the largest representable floating point number, positive infinity is returned. * If the number is less than the smallest representable floating point number, negative infinity is returned. + * + * @pure */ abstract public function toFloat() : float; @@ -504,6 +543,8 @@ abstract class BigNumber implements \JsonSerializable * * The output of this method can be parsed by the `of()` factory method; * this will yield an object equal to this one, without any information loss. + * + * @pure */ abstract public function __toString() : string; diff --git a/vendor/brick/math/src/BigRational.php b/vendor/brick/math/src/BigRational.php index fc36e55..56045e5 100644 --- a/vendor/brick/math/src/BigRational.php +++ b/vendor/brick/math/src/BigRational.php @@ -14,20 +14,18 @@ use Override; * An arbitrarily large rational number. * * This class is immutable. - * - * @psalm-immutable */ -final class BigRational extends BigNumber +final readonly class BigRational extends BigNumber { /** * The numerator. */ - private readonly BigInteger $numerator; + private BigInteger $numerator; /** * The denominator. Always strictly positive. */ - private readonly BigInteger $denominator; + private BigInteger $denominator; /** * Protected constructor. Use a factory method to obtain an instance. @@ -37,6 +35,8 @@ final class BigRational extends BigNumber * @param bool $checkDenominator Whether to check the denominator for negative and zero. * * @throws DivisionByZeroException If the denominator is zero. + * + * @pure */ protected function __construct(BigInteger $numerator, BigInteger $denominator, bool $checkDenominator) { @@ -55,9 +55,6 @@ final class BigRational extends BigNumber $this->denominator = $denominator; } - /** - * @psalm-pure - */ #[Override] protected static function from(BigNumber $number): static { @@ -77,7 +74,7 @@ final class BigRational extends BigNumber * @throws RoundingNecessaryException If an argument represents a non-integer number. * @throws DivisionByZeroException If the denominator is zero. * - * @psalm-pure + * @pure */ public static function nd( BigNumber|int|float|string $numerator, @@ -92,14 +89,11 @@ final class BigRational extends BigNumber /** * Returns a BigRational representing zero. * - * @psalm-pure + * @pure */ public static function zero() : BigRational { - /** - * @psalm-suppress ImpureStaticVariable - * @var BigRational|null $zero - */ + /** @var BigRational|null $zero */ static $zero; if ($zero === null) { @@ -112,14 +106,11 @@ final class BigRational extends BigNumber /** * Returns a BigRational representing one. * - * @psalm-pure + * @pure */ public static function one() : BigRational { - /** - * @psalm-suppress ImpureStaticVariable - * @var BigRational|null $one - */ + /** @var BigRational|null $one */ static $one; if ($one === null) { @@ -132,14 +123,11 @@ final class BigRational extends BigNumber /** * Returns a BigRational representing ten. * - * @psalm-pure + * @pure */ public static function ten() : BigRational { - /** - * @psalm-suppress ImpureStaticVariable - * @var BigRational|null $ten - */ + /** @var BigRational|null $ten */ static $ten; if ($ten === null) { @@ -149,11 +137,17 @@ final class BigRational extends BigNumber return $ten; } + /** + * @pure + */ public function getNumerator() : BigInteger { return $this->numerator; } + /** + * @pure + */ public function getDenominator() : BigInteger { return $this->denominator; @@ -161,6 +155,8 @@ final class BigRational extends BigNumber /** * Returns the quotient of the division of the numerator by the denominator. + * + * @pure */ public function quotient() : BigInteger { @@ -169,6 +165,8 @@ final class BigRational extends BigNumber /** * Returns the remainder of the division of the numerator by the denominator. + * + * @pure */ public function remainder() : BigInteger { @@ -178,9 +176,9 @@ final class BigRational extends BigNumber /** * Returns the quotient and remainder of the division of the numerator by the denominator. * - * @return BigInteger[] + * @return array{BigInteger, BigInteger} * - * @psalm-return array{BigInteger, BigInteger} + * @pure */ public function quotientAndRemainder() : array { @@ -193,6 +191,8 @@ final class BigRational extends BigNumber * @param BigNumber|int|float|string $that The number to add. * * @throws MathException If the number is not valid. + * + * @pure */ public function plus(BigNumber|int|float|string $that) : BigRational { @@ -211,6 +211,8 @@ final class BigRational extends BigNumber * @param BigNumber|int|float|string $that The number to subtract. * * @throws MathException If the number is not valid. + * + * @pure */ public function minus(BigNumber|int|float|string $that) : BigRational { @@ -229,6 +231,8 @@ final class BigRational extends BigNumber * @param BigNumber|int|float|string $that The multiplier. * * @throws MathException If the multiplier is not a valid number. + * + * @pure */ public function multipliedBy(BigNumber|int|float|string $that) : BigRational { @@ -246,6 +250,8 @@ final class BigRational extends BigNumber * @param BigNumber|int|float|string $that The divisor. * * @throws MathException If the divisor is not a valid number, or is zero. + * + * @pure */ public function dividedBy(BigNumber|int|float|string $that) : BigRational { @@ -261,6 +267,8 @@ final class BigRational extends BigNumber * Returns this number exponentiated to the given value. * * @throws \InvalidArgumentException If the exponent is not in the range 0 to 1,000,000. + * + * @pure */ public function power(int $exponent) : BigRational { @@ -287,6 +295,8 @@ final class BigRational extends BigNumber * The reciprocal has the numerator and denominator swapped. * * @throws DivisionByZeroException If the numerator is zero. + * + * @pure */ public function reciprocal() : BigRational { @@ -295,6 +305,8 @@ final class BigRational extends BigNumber /** * Returns the absolute value of this BigRational. + * + * @pure */ public function abs() : BigRational { @@ -303,6 +315,8 @@ final class BigRational extends BigNumber /** * Returns the negated value of this BigRational. + * + * @pure */ public function negated() : BigRational { @@ -311,6 +325,8 @@ final class BigRational extends BigNumber /** * Returns the simplified value of this BigRational. + * + * @pure */ public function simplified() : BigRational { @@ -406,7 +422,6 @@ final class BigRational extends BigNumber * This method is only here to allow unserializing the object and cannot be accessed directly. * * @internal - * @psalm-suppress RedundantPropertyInitializationCheck * * @param array{numerator: BigInteger, denominator: BigInteger} $data * @@ -414,10 +429,12 @@ final class BigRational extends BigNumber */ public function __unserialize(array $data): void { + /** @phpstan-ignore isset.initializedProperty */ if (isset($this->numerator)) { throw new \LogicException('__unserialize() is an internal function, it must not be called directly.'); } + /** @phpstan-ignore deadCode.unreachable */ $this->numerator = $data['numerator']; $this->denominator = $data['denominator']; } diff --git a/vendor/brick/math/src/Exception/DivisionByZeroException.php b/vendor/brick/math/src/Exception/DivisionByZeroException.php index ce7769a..2daaf5e 100644 --- a/vendor/brick/math/src/Exception/DivisionByZeroException.php +++ b/vendor/brick/math/src/Exception/DivisionByZeroException.php @@ -7,10 +7,10 @@ namespace Brick\Math\Exception; /** * Exception thrown when a division by zero occurs. */ -class DivisionByZeroException extends MathException +final class DivisionByZeroException extends MathException { /** - * @psalm-pure + * @pure */ public static function divisionByZero() : DivisionByZeroException { @@ -18,7 +18,7 @@ class DivisionByZeroException extends MathException } /** - * @psalm-pure + * @pure */ public static function modulusMustNotBeZero() : DivisionByZeroException { @@ -26,7 +26,7 @@ class DivisionByZeroException extends MathException } /** - * @psalm-pure + * @pure */ public static function denominatorMustNotBeZero() : DivisionByZeroException { diff --git a/vendor/brick/math/src/Exception/IntegerOverflowException.php b/vendor/brick/math/src/Exception/IntegerOverflowException.php index c73b490..56f3cf8 100644 --- a/vendor/brick/math/src/Exception/IntegerOverflowException.php +++ b/vendor/brick/math/src/Exception/IntegerOverflowException.php @@ -9,10 +9,10 @@ use Brick\Math\BigInteger; /** * Exception thrown when an integer overflow occurs. */ -class IntegerOverflowException extends MathException +final class IntegerOverflowException extends MathException { /** - * @psalm-pure + * @pure */ public static function toIntOverflow(BigInteger $value) : IntegerOverflowException { diff --git a/vendor/brick/math/src/Exception/NegativeNumberException.php b/vendor/brick/math/src/Exception/NegativeNumberException.php index 4739113..73ed3a4 100644 --- a/vendor/brick/math/src/Exception/NegativeNumberException.php +++ b/vendor/brick/math/src/Exception/NegativeNumberException.php @@ -7,6 +7,6 @@ namespace Brick\Math\Exception; /** * Exception thrown when attempting to perform an unsupported operation, such as a square root, on a negative number. */ -class NegativeNumberException extends MathException +final class NegativeNumberException extends MathException { } diff --git a/vendor/brick/math/src/Exception/NumberFormatException.php b/vendor/brick/math/src/Exception/NumberFormatException.php index 119cadb..0dcda34 100644 --- a/vendor/brick/math/src/Exception/NumberFormatException.php +++ b/vendor/brick/math/src/Exception/NumberFormatException.php @@ -7,8 +7,11 @@ namespace Brick\Math\Exception; /** * Exception thrown when attempting to create a number from a string with an invalid format. */ -class NumberFormatException extends MathException +final class NumberFormatException extends MathException { + /** + * @pure + */ public static function invalidFormat(string $value) : self { return new self(\sprintf( @@ -20,7 +23,7 @@ class NumberFormatException extends MathException /** * @param string $char The failing character. * - * @psalm-pure + * @pure */ public static function charNotInAlphabet(string $char) : self { diff --git a/vendor/brick/math/src/Exception/RoundingNecessaryException.php b/vendor/brick/math/src/Exception/RoundingNecessaryException.php index 57bfcd8..034a040 100644 --- a/vendor/brick/math/src/Exception/RoundingNecessaryException.php +++ b/vendor/brick/math/src/Exception/RoundingNecessaryException.php @@ -7,10 +7,10 @@ namespace Brick\Math\Exception; /** * Exception thrown when a number cannot be represented at the requested scale without rounding. */ -class RoundingNecessaryException extends MathException +final class RoundingNecessaryException extends MathException { /** - * @psalm-pure + * @pure */ public static function roundingNecessary() : RoundingNecessaryException { diff --git a/vendor/brick/math/src/Internal/Calculator.php b/vendor/brick/math/src/Internal/Calculator.php index 44dd669..a5e000a 100644 --- a/vendor/brick/math/src/Internal/Calculator.php +++ b/vendor/brick/math/src/Internal/Calculator.php @@ -17,10 +17,8 @@ use Brick\Math\RoundingMode; * All methods must return strings respecting this format, unless specified otherwise. * * @internal - * - * @psalm-immutable */ -abstract class Calculator +abstract readonly class Calculator { /** * The maximum exponent value allowed for the pow() method. @@ -32,63 +30,12 @@ abstract class Calculator */ public const ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyz'; - /** - * The Calculator instance in use. - */ - private static ?Calculator $instance = null; - - /** - * Sets the Calculator instance to use. - * - * An instance is typically set only in unit tests: the autodetect is usually the best option. - * - * @param Calculator|null $calculator The calculator instance, or NULL to revert to autodetect. - */ - final public static function set(?Calculator $calculator) : void - { - self::$instance = $calculator; - } - - /** - * Returns the Calculator instance to use. - * - * If none has been explicitly set, the fastest available implementation will be returned. - * - * @psalm-pure - * @psalm-suppress ImpureStaticProperty - */ - final public static function get() : Calculator - { - if (self::$instance === null) { - /** @psalm-suppress ImpureMethodCall */ - self::$instance = self::detect(); - } - - return self::$instance; - } - - /** - * Returns the fastest available Calculator implementation. - * - * @codeCoverageIgnore - */ - private static function detect() : Calculator - { - if (\extension_loaded('gmp')) { - return new Calculator\GmpCalculator(); - } - - if (\extension_loaded('bcmath')) { - return new Calculator\BcMathCalculator(); - } - - return new Calculator\NativeCalculator(); - } - /** * Extracts the sign & digits of the operands. * * @return array{bool, bool, string, string} Whether $a and $b are negative, followed by their digits. + * + * @pure */ final protected function init(string $a, string $b) : array { @@ -103,6 +50,8 @@ abstract class Calculator /** * Returns the absolute value of a number. + * + * @pure */ final public function abs(string $n) : string { @@ -111,6 +60,8 @@ abstract class Calculator /** * Negates a number. + * + * @pure */ final public function neg(string $n) : string { @@ -128,9 +79,11 @@ abstract class Calculator /** * Compares two numbers. * - * @psalm-return -1|0|1 + * Returns -1 if the first number is less than, 0 if equal to, 1 if greater than the second number. * - * @return int -1 if the first number is less than, 0 if equal to, 1 if greater than the second number. + * @return -1|0|1 + * + * @pure */ final public function cmp(string $a, string $b) : int { @@ -160,16 +113,22 @@ abstract class Calculator /** * Adds two numbers. + * + * @pure */ abstract public function add(string $a, string $b) : string; /** * Subtracts two numbers. + * + * @pure */ abstract public function sub(string $a, string $b) : string; /** * Multiplies two numbers. + * + * @pure */ abstract public function mul(string $a, string $b) : string; @@ -180,6 +139,8 @@ abstract class Calculator * @param string $b The divisor, must not be zero. * * @return string The quotient. + * + * @pure */ abstract public function divQ(string $a, string $b) : string; @@ -190,6 +151,8 @@ abstract class Calculator * @param string $b The divisor, must not be zero. * * @return string The remainder. + * + * @pure */ abstract public function divR(string $a, string $b) : string; @@ -200,6 +163,8 @@ abstract class Calculator * @param string $b The divisor, must not be zero. * * @return array{string, string} An array containing the quotient and remainder. + * + * @pure */ abstract public function divQR(string $a, string $b) : array; @@ -210,11 +175,15 @@ abstract class Calculator * @param int $e The exponent, validated as an integer between 0 and MAX_POWER. * * @return string The power. + * + * @pure */ abstract public function pow(string $a, int $e) : string; /** * @param string $b The modulus; must not be zero. + * + * @pure */ public function mod(string $a, string $b) : string { @@ -229,6 +198,8 @@ abstract class Calculator * This method can be overridden by the concrete implementation if the underlying library has built-in support. * * @param string $m The modulus; must not be negative or zero. + * + * @pure */ public function modInverse(string $x, string $m) : ?string { @@ -257,6 +228,8 @@ abstract class Calculator * @param string $base The base number; must be positive or zero. * @param string $exp The exponent; must be positive or zero. * @param string $mod The modulus; must be strictly positive. + * + * @pure */ abstract public function modPow(string $base, string $exp, string $mod) : string; @@ -267,6 +240,8 @@ abstract class Calculator * has built-in support for GCD calculations. * * @return string The GCD, always positive, or zero if both arguments are zero. + * + * @pure */ public function gcd(string $a, string $b) : string { @@ -283,6 +258,8 @@ abstract class Calculator /** * @return array{string, string, string} GCD, X, Y + * + * @pure */ private function gcdExtended(string $a, string $b) : array { @@ -303,6 +280,8 @@ abstract class Calculator * * The result is the largest x such that x² ≤ n. * The input MUST NOT be negative. + * + * @pure */ abstract public function sqrt(string $n) : string; @@ -316,6 +295,8 @@ abstract class Calculator * @param int $base The base of the number, validated from 2 to 36. * * @return string The converted number, following the Calculator conventions. + * + * @pure */ public function fromBase(string $number, int $base) : string { @@ -332,6 +313,8 @@ abstract class Calculator * @param int $base The base to convert to, validated from 2 to 36. * * @return string The converted number, lowercase. + * + * @pure */ public function toBase(string $number, int $base) : string { @@ -359,6 +342,8 @@ abstract class Calculator * @param int $base The base of the number, validated from 2 to alphabet length. * * @return string The number in base 10, following the Calculator conventions. + * + * @pure */ final public function fromArbitraryBase(string $number, string $alphabet, int $base) : string { @@ -405,6 +390,8 @@ abstract class Calculator * @param int $base The base to convert to, validated from 2 to alphabet length. * * @return string The converted number in the given alphabet. + * + * @pure */ final public function toArbitraryBase(string $number, string $alphabet, int $base) : string { @@ -434,10 +421,9 @@ abstract class Calculator * @param string $b The divisor, must not be zero. * @param RoundingMode $roundingMode The rounding mode. * - * @throws \InvalidArgumentException If the rounding mode is invalid. * @throws RoundingNecessaryException If RoundingMode::UNNECESSARY is provided but rounding is necessary. * - * @psalm-suppress ImpureFunctionCall + * @pure */ final public function divRound(string $a, string $b, RoundingMode $roundingMode) : string { @@ -498,9 +484,6 @@ abstract class Calculator $lastDigitIsEven = ($lastDigit % 2 === 0); $increment = $lastDigitIsEven ? $discardedFractionSign() > 0 : $discardedFractionSign() >= 0; break; - - default: - throw new \InvalidArgumentException('Invalid rounding mode.'); } if ($increment) { @@ -515,6 +498,8 @@ abstract class Calculator * * This method can be overridden by the concrete implementation if the underlying library * has built-in support for bitwise operations. + * + * @pure */ public function and(string $a, string $b) : string { @@ -526,6 +511,8 @@ abstract class Calculator * * This method can be overridden by the concrete implementation if the underlying library * has built-in support for bitwise operations. + * + * @pure */ public function or(string $a, string $b) : string { @@ -537,6 +524,8 @@ abstract class Calculator * * This method can be overridden by the concrete implementation if the underlying library * has built-in support for bitwise operations. + * + * @pure */ public function xor(string $a, string $b) : string { @@ -549,6 +538,8 @@ abstract class Calculator * @param 'and'|'or'|'xor' $operator The operator to use. * @param string $a The left operand. * @param string $b The right operand. + * + * @pure */ private function bitwise(string $operator, string $a, string $b) : string { @@ -596,6 +587,8 @@ abstract class Calculator /** * @param string $number A positive, binary number. + * + * @pure */ private function twosComplement(string $number) : string { @@ -625,6 +618,8 @@ abstract class Calculator * Converts a decimal number to a binary string. * * @param string $number The number to convert, positive or zero, only digits. + * + * @pure */ private function toBinary(string $number) : string { @@ -642,6 +637,8 @@ abstract class Calculator * Returns the positive decimal representation of a binary number. * * @param string $bytes The bytes representing the number. + * + * @pure */ private function toDecimal(string $bytes) : string { diff --git a/vendor/brick/math/src/Internal/Calculator/BcMathCalculator.php b/vendor/brick/math/src/Internal/Calculator/BcMathCalculator.php index 93a27ff..5ba961e 100644 --- a/vendor/brick/math/src/Internal/Calculator/BcMathCalculator.php +++ b/vendor/brick/math/src/Internal/Calculator/BcMathCalculator.php @@ -11,10 +11,8 @@ use Override; * Calculator implementation built around the bcmath library. * * @internal - * - * @psalm-immutable */ -class BcMathCalculator extends Calculator +final readonly class BcMathCalculator extends Calculator { #[Override] public function add(string $a, string $b) : string diff --git a/vendor/brick/math/src/Internal/Calculator/GmpCalculator.php b/vendor/brick/math/src/Internal/Calculator/GmpCalculator.php index 0e44dee..c0f9bd5 100644 --- a/vendor/brick/math/src/Internal/Calculator/GmpCalculator.php +++ b/vendor/brick/math/src/Internal/Calculator/GmpCalculator.php @@ -5,16 +5,15 @@ declare(strict_types=1); namespace Brick\Math\Internal\Calculator; use Brick\Math\Internal\Calculator; +use GMP; use Override; /** * Calculator implementation built around the GMP library. * * @internal - * - * @psalm-immutable */ -class GmpCalculator extends Calculator +final readonly class GmpCalculator extends Calculator { #[Override] public function add(string $a, string $b) : string @@ -51,6 +50,10 @@ class GmpCalculator extends Calculator { [$q, $r] = \gmp_div_qr($a, $b); + /** + * @var GMP $q + * @var GMP $r + */ return [ \gmp_strval($q), \gmp_strval($r) diff --git a/vendor/brick/math/src/Internal/Calculator/NativeCalculator.php b/vendor/brick/math/src/Internal/Calculator/NativeCalculator.php index f71c55b..ee476c9 100644 --- a/vendor/brick/math/src/Internal/Calculator/NativeCalculator.php +++ b/vendor/brick/math/src/Internal/Calculator/NativeCalculator.php @@ -11,10 +11,8 @@ use Override; * Calculator implementation using only native PHP code. * * @internal - * - * @psalm-immutable */ -class NativeCalculator extends Calculator +final readonly class NativeCalculator extends Calculator { /** * The max number of digits the platform can natively add, subtract, multiply or divide without overflow. @@ -24,9 +22,10 @@ class NativeCalculator extends Calculator * Example: 32-bit: max number 1,999,999,999 (9 digits + carry) * 64-bit: max number 1,999,999,999,999,999,999 (18 digits + carry) */ - private readonly int $maxDigits; + private int $maxDigits; /** + * @pure * @codeCoverageIgnore */ public function __construct() @@ -34,7 +33,6 @@ class NativeCalculator extends Calculator $this->maxDigits = match (PHP_INT_SIZE) { 4 => 9, 8 => 18, - default => throw new \RuntimeException('The platform is not 32-bit or 64-bit as expected.') }; } @@ -42,8 +40,8 @@ class NativeCalculator extends Calculator public function add(string $a, string $b) : string { /** - * @psalm-var numeric-string $a - * @psalm-var numeric-string $b + * @var numeric-string $a + * @var numeric-string $b */ $result = $a + $b; @@ -80,8 +78,8 @@ class NativeCalculator extends Calculator public function mul(string $a, string $b) : string { /** - * @psalm-var numeric-string $a - * @psalm-var numeric-string $b + * @var numeric-string $a + * @var numeric-string $b */ $result = $a * $b; @@ -151,11 +149,11 @@ class NativeCalculator extends Calculator return [$this->neg($a), '0']; } - /** @psalm-var numeric-string $a */ + /** @var numeric-string $a */ $na = $a * 1; // cast to number if (is_int($na)) { - /** @psalm-var numeric-string $b */ + /** @var numeric-string $b */ $nb = $b * 1; if (is_int($nb)) { @@ -202,7 +200,6 @@ class NativeCalculator extends Calculator $aa = $this->mul($a, $a); - /** @psalm-suppress PossiblyInvalidArgument We're sure that $e / 2 is an int now */ $result = $this->pow($aa, $e / 2); if ($odd === 1) { @@ -278,6 +275,8 @@ class NativeCalculator extends Calculator /** * Performs the addition of two non-signed large integers. + * + * @pure */ private function doAdd(string $a, string $b) : string { @@ -291,14 +290,13 @@ class NativeCalculator extends Calculator if ($i < 0) { $blockLength += $i; - /** @psalm-suppress LoopInvalidation */ $i = 0; } - /** @psalm-var numeric-string $blockA */ + /** @var numeric-string $blockA */ $blockA = \substr($a, $i, $blockLength); - /** @psalm-var numeric-string $blockB */ + /** @var numeric-string $blockB */ $blockB = \substr($b, $i, $blockLength); $sum = (string) ($blockA + $blockB + $carry); @@ -330,6 +328,8 @@ class NativeCalculator extends Calculator /** * Performs the subtraction of two non-signed large integers. + * + * @pure */ private function doSub(string $a, string $b) : string { @@ -360,14 +360,13 @@ class NativeCalculator extends Calculator if ($i < 0) { $blockLength += $i; - /** @psalm-suppress LoopInvalidation */ $i = 0; } - /** @psalm-var numeric-string $blockA */ + /** @var numeric-string $blockA */ $blockA = \substr($a, $i, $blockLength); - /** @psalm-var numeric-string $blockB */ + /** @var numeric-string $blockB */ $blockB = \substr($b, $i, $blockLength); $sum = $blockA - $blockB - $carry; @@ -407,6 +406,8 @@ class NativeCalculator extends Calculator /** * Performs the multiplication of two non-signed large integers. + * + * @pure */ private function doMul(string $a, string $b) : string { @@ -423,7 +424,6 @@ class NativeCalculator extends Calculator if ($i < 0) { $blockALength += $i; - /** @psalm-suppress LoopInvalidation */ $i = 0; } @@ -437,7 +437,6 @@ class NativeCalculator extends Calculator if ($j < 0) { $blockBLength += $j; - /** @psalm-suppress LoopInvalidation */ $j = 0; } @@ -480,6 +479,8 @@ class NativeCalculator extends Calculator * Performs the division of two non-signed large integers. * * @return string[] The quotient and remainder. + * + * @pure */ private function doDiv(string $a, string $b) : array { @@ -498,7 +499,7 @@ class NativeCalculator extends Calculator $r = $a; // remainder $z = $y; // focus length, always $y or $y+1 - /** @psalm-var numeric-string $b */ + /** @var numeric-string $b */ $nb = $b * 1; // cast to number // performance optimization in cases where the remainder will never cause int overflow if (is_int(($nb - 1) * 10 + 9)) { @@ -506,7 +507,7 @@ class NativeCalculator extends Calculator for ($i = $z - 1; $i < $x; $i++) { $n = $r * 10 + (int) $a[$i]; - /** @psalm-var int $nb */ + /** @var int $nb */ $q .= \intdiv($n, $nb); $r = $n % $nb; } @@ -553,7 +554,9 @@ class NativeCalculator extends Calculator /** * Compares two non-signed large numbers. * - * @psalm-return -1|0|1 + * @return -1|0|1 + * + * @pure */ private function doCmp(string $a, string $b) : int { @@ -575,6 +578,8 @@ class NativeCalculator extends Calculator * The numbers must only consist of digits, without leading minus sign. * * @return array{string, string, int} + * + * @pure */ private function pad(string $a, string $b) : array { diff --git a/vendor/brick/math/src/Internal/CalculatorRegistry.php b/vendor/brick/math/src/Internal/CalculatorRegistry.php new file mode 100644 index 0000000..394fae6 --- /dev/null +++ b/vendor/brick/math/src/Internal/CalculatorRegistry.php @@ -0,0 +1,73 @@ +}|array{}|null */ private static $installed; + /** + * @var bool + */ + private static $installedIsLocalDir; + /** * @var bool|null */ @@ -309,6 +320,24 @@ class InstalledVersions { self::$installed = $data; self::$installedByVendor = array(); + + // when using reload, we disable the duplicate protection to ensure that self::$installed data is + // always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not, + // so we have to assume it does not, and that may result in duplicate data being returned when listing + // all installed packages for example + self::$installedIsLocalDir = false; + } + + /** + * @return string + */ + private static function getSelfDir() + { + if (self::$selfDir === null) { + self::$selfDir = strtr(__DIR__, '\\', '/'); + } + + return self::$selfDir; } /** @@ -322,19 +351,27 @@ class InstalledVersions } $installed = array(); + $copiedLocalDir = false; if (self::$canGetVendors) { + $selfDir = self::getSelfDir(); foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { + $vendorDir = strtr($vendorDir, '\\', '/'); if (isset(self::$installedByVendor[$vendorDir])) { $installed[] = self::$installedByVendor[$vendorDir]; } elseif (is_file($vendorDir.'/composer/installed.php')) { /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */ $required = require $vendorDir.'/composer/installed.php'; - $installed[] = self::$installedByVendor[$vendorDir] = $required; - if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { - self::$installed = $installed[count($installed) - 1]; + self::$installedByVendor[$vendorDir] = $required; + $installed[] = $required; + if (self::$installed === null && $vendorDir.'/composer' === $selfDir) { + self::$installed = $required; + self::$installedIsLocalDir = true; } } + if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) { + $copiedLocalDir = true; + } } } @@ -350,7 +387,7 @@ class InstalledVersions } } - if (self::$installed !== array()) { + if (self::$installed !== array() && !$copiedLocalDir) { $installed[] = self::$installed; } diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php index 845579b..f5861b8 100644 --- a/vendor/composer/autoload_psr4.php +++ b/vendor/composer/autoload_psr4.php @@ -32,12 +32,12 @@ return array( 'Ramsey\\Uuid\\' => array($vendorDir . '/ramsey/uuid/src'), 'Ramsey\\Collection\\' => array($vendorDir . '/ramsey/collection/src'), 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'), - 'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src', $vendorDir . '/psr/http-factory/src'), + 'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-factory/src', $vendorDir . '/psr/http-message/src'), 'Psr\\Http\\Client\\' => array($vendorDir . '/psr/http-client/src'), 'Predis\\' => array($vendorDir . '/predis/predis/src'), 'Masterminds\\' => array($vendorDir . '/masterminds/html5/src'), 'Jfcherng\\Utility\\' => array($vendorDir . '/jfcherng/php-mb-string/src', $vendorDir . '/jfcherng/php-color-output/src'), - 'Jfcherng\\Diff\\' => array($vendorDir . '/jfcherng/php-sequence-matcher/src', $vendorDir . '/jfcherng/php-diff/src'), + 'Jfcherng\\Diff\\' => array($vendorDir . '/jfcherng/php-diff/src', $vendorDir . '/jfcherng/php-sequence-matcher/src'), 'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'), 'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'), 'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'), diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index d74ecc8..5592587 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -226,8 +226,8 @@ class ComposerStaticInit5d5db0943532ec3ad2d064ba31305947 ), 'Psr\\Http\\Message\\' => array ( - 0 => __DIR__ . '/..' . '/psr/http-message/src', - 1 => __DIR__ . '/..' . '/psr/http-factory/src', + 0 => __DIR__ . '/..' . '/psr/http-factory/src', + 1 => __DIR__ . '/..' . '/psr/http-message/src', ), 'Psr\\Http\\Client\\' => array ( @@ -248,8 +248,8 @@ class ComposerStaticInit5d5db0943532ec3ad2d064ba31305947 ), 'Jfcherng\\Diff\\' => array ( - 0 => __DIR__ . '/..' . '/jfcherng/php-sequence-matcher/src', - 1 => __DIR__ . '/..' . '/jfcherng/php-diff/src', + 0 => __DIR__ . '/..' . '/jfcherng/php-diff/src', + 1 => __DIR__ . '/..' . '/jfcherng/php-sequence-matcher/src', ), 'GuzzleHttp\\Psr7\\' => array ( diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 7fc1212..7453c44 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -2,28 +2,28 @@ "packages": [ { "name": "brick/math", - "version": "0.13.1", - "version_normalized": "0.13.1.0", + "version": "0.14.0", + "version_normalized": "0.14.0.0", "source": { "type": "git", "url": "https://github.com/brick/math.git", - "reference": "fc7ed316430118cc7836bf45faff18d5dfc8de04" + "reference": "113a8ee2656b882d4c3164fa31aa6e12cbb7aaa2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/brick/math/zipball/fc7ed316430118cc7836bf45faff18d5dfc8de04", - "reference": "fc7ed316430118cc7836bf45faff18d5dfc8de04", + "url": "https://api.github.com/repos/brick/math/zipball/113a8ee2656b882d4c3164fa31aa6e12cbb7aaa2", + "reference": "113a8ee2656b882d4c3164fa31aa6e12cbb7aaa2", "shasum": "" }, "require": { - "php": "^8.1" + "php": "^8.2" }, "require-dev": { "php-coveralls/php-coveralls": "^2.2", - "phpunit/phpunit": "^10.1", - "vimeo/psalm": "6.8.8" + "phpstan/phpstan": "2.1.22", + "phpunit/phpunit": "^11.5" }, - "time": "2025-03-29T13:50:30+00:00", + "time": "2025-08-29T12:40:03+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -53,7 +53,7 @@ ], "support": { "issues": "https://github.com/brick/math/issues", - "source": "https://github.com/brick/math/tree/0.13.1" + "source": "https://github.com/brick/math/tree/0.14.0" }, "funding": [ { @@ -1618,23 +1618,23 @@ }, { "name": "guzzlehttp/guzzle", - "version": "7.9.3", - "version_normalized": "7.9.3.0", + "version": "7.10.0", + "version_normalized": "7.10.0.0", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "7b2f29fe81dc4da0ca0ea7d42107a0845946ea77" + "reference": "b51ac707cfa420b7bfd4e4d5e510ba8008e822b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/7b2f29fe81dc4da0ca0ea7d42107a0845946ea77", - "reference": "7b2f29fe81dc4da0ca0ea7d42107a0845946ea77", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/b51ac707cfa420b7bfd4e4d5e510ba8008e822b4", + "reference": "b51ac707cfa420b7bfd4e4d5e510ba8008e822b4", "shasum": "" }, "require": { "ext-json": "*", - "guzzlehttp/promises": "^1.5.3 || ^2.0.3", - "guzzlehttp/psr7": "^2.7.0", + "guzzlehttp/promises": "^2.3", + "guzzlehttp/psr7": "^2.8", "php": "^7.2.5 || ^8.0", "psr/http-client": "^1.0", "symfony/deprecation-contracts": "^2.2 || ^3.0" @@ -1655,7 +1655,7 @@ "ext-intl": "Required for Internationalized Domain Name (IDN) support", "psr/log": "Required for using the Log middleware" }, - "time": "2025-03-27T13:37:11+00:00", + "time": "2025-08-23T22:36:01+00:00", "type": "library", "extra": { "bamarni-bin": { @@ -1727,7 +1727,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.9.3" + "source": "https://github.com/guzzle/guzzle/tree/7.10.0" }, "funding": [ { @@ -1747,17 +1747,17 @@ }, { "name": "guzzlehttp/promises", - "version": "2.2.0", - "version_normalized": "2.2.0.0", + "version": "2.3.0", + "version_normalized": "2.3.0.0", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "7c69f28996b0a6920945dd20b3857e499d9ca96c" + "reference": "481557b130ef3790cf82b713667b43030dc9c957" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/7c69f28996b0a6920945dd20b3857e499d9ca96c", - "reference": "7c69f28996b0a6920945dd20b3857e499d9ca96c", + "url": "https://api.github.com/repos/guzzle/promises/zipball/481557b130ef3790cf82b713667b43030dc9c957", + "reference": "481557b130ef3790cf82b713667b43030dc9c957", "shasum": "" }, "require": { @@ -1765,9 +1765,9 @@ }, "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", - "phpunit/phpunit": "^8.5.39 || ^9.6.20" + "phpunit/phpunit": "^8.5.44 || ^9.6.25" }, - "time": "2025-03-27T13:27:01+00:00", + "time": "2025-08-22T14:34:08+00:00", "type": "library", "extra": { "bamarni-bin": { @@ -1813,7 +1813,7 @@ ], "support": { "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/2.2.0" + "source": "https://github.com/guzzle/promises/tree/2.3.0" }, "funding": [ { @@ -1833,17 +1833,17 @@ }, { "name": "guzzlehttp/psr7", - "version": "2.7.1", - "version_normalized": "2.7.1.0", + "version": "2.8.0", + "version_normalized": "2.8.0.0", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "c2270caaabe631b3b44c85f99e5a04bbb8060d16" + "reference": "21dc724a0583619cd1652f673303492272778051" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/c2270caaabe631b3b44c85f99e5a04bbb8060d16", - "reference": "c2270caaabe631b3b44c85f99e5a04bbb8060d16", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/21dc724a0583619cd1652f673303492272778051", + "reference": "21dc724a0583619cd1652f673303492272778051", "shasum": "" }, "require": { @@ -1859,12 +1859,12 @@ "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", "http-interop/http-factory-tests": "0.9.0", - "phpunit/phpunit": "^8.5.39 || ^9.6.20" + "phpunit/phpunit": "^8.5.44 || ^9.6.25" }, "suggest": { "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" }, - "time": "2025-03-27T12:30:47+00:00", + "time": "2025-08-23T21:21:41+00:00", "type": "library", "extra": { "bamarni-bin": { @@ -1932,7 +1932,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.7.1" + "source": "https://github.com/guzzle/psr7/tree/2.8.0" }, "funding": [ { @@ -2271,17 +2271,17 @@ }, { "name": "predis/predis", - "version": "v3.0.1", - "version_normalized": "3.0.1.0", + "version": "v3.2.0", + "version_normalized": "3.2.0.0", "source": { "type": "git", "url": "https://github.com/predis/predis.git", - "reference": "34fb0a7da0330df1bab4280fcac4afdeeccc3edf" + "reference": "c1845d96ccbceb1269387d1c294fd7e4876f6307" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/predis/predis/zipball/34fb0a7da0330df1bab4280fcac4afdeeccc3edf", - "reference": "34fb0a7da0330df1bab4280fcac4afdeeccc3edf", + "url": "https://api.github.com/repos/predis/predis/zipball/c1845d96ccbceb1269387d1c294fd7e4876f6307", + "reference": "c1845d96ccbceb1269387d1c294fd7e4876f6307", "shasum": "" }, "require": { @@ -2297,7 +2297,7 @@ "suggest": { "ext-relay": "Faster connection with in-memory caching (>=0.6.2)" }, - "time": "2025-05-16T18:30:32+00:00", + "time": "2025-08-03T19:20:07+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -2325,7 +2325,7 @@ ], "support": { "issues": "https://github.com/predis/predis/issues", - "source": "https://github.com/predis/predis/tree/v3.0.1" + "source": "https://github.com/predis/predis/tree/v3.2.0" }, "funding": [ { @@ -2685,21 +2685,21 @@ }, { "name": "ramsey/uuid", - "version": "4.9.0", - "version_normalized": "4.9.0.0", + "version": "4.9.1", + "version_normalized": "4.9.1.0", "source": { "type": "git", "url": "https://github.com/ramsey/uuid.git", - "reference": "4e0e23cc785f0724a0e838279a9eb03f28b092a0" + "reference": "81f941f6f729b1e3ceea61d9d014f8b6c6800440" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/uuid/zipball/4e0e23cc785f0724a0e838279a9eb03f28b092a0", - "reference": "4e0e23cc785f0724a0e838279a9eb03f28b092a0", + "url": "https://api.github.com/repos/ramsey/uuid/zipball/81f941f6f729b1e3ceea61d9d014f8b6c6800440", + "reference": "81f941f6f729b1e3ceea61d9d014f8b6c6800440", "shasum": "" }, "require": { - "brick/math": "^0.8.8 || ^0.9 || ^0.10 || ^0.11 || ^0.12 || ^0.13", + "brick/math": "^0.8.8 || ^0.9 || ^0.10 || ^0.11 || ^0.12 || ^0.13 || ^0.14", "php": "^8.0", "ramsey/collection": "^1.2 || ^2.0" }, @@ -2732,7 +2732,7 @@ "paragonie/random-lib": "Provides RandomLib for use with the RandomLibAdapter", "ramsey/uuid-doctrine": "Allows the use of Ramsey\\Uuid\\Uuid as Doctrine field type." }, - "time": "2025-06-25T14:20:11+00:00", + "time": "2025-09-04T20:59:21+00:00", "type": "library", "extra": { "captainhook": { @@ -2760,7 +2760,7 @@ ], "support": { "issues": "https://github.com/ramsey/uuid/issues", - "source": "https://github.com/ramsey/uuid/tree/4.9.0" + "source": "https://github.com/ramsey/uuid/tree/4.9.1" }, "install-path": "../ramsey/uuid" }, @@ -4155,8 +4155,8 @@ }, { "name": "symfony/polyfill-php81", - "version": "v1.32.0", - "version_normalized": "1.32.0.0", + "version": "v1.33.0", + "version_normalized": "1.33.0.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php81.git", @@ -4214,7 +4214,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php81/tree/v1.32.0" + "source": "https://github.com/symfony/polyfill-php81/tree/v1.33.0" }, "funding": [ { @@ -4225,6 +4225,10 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" @@ -4392,17 +4396,17 @@ }, { "name": "tedivm/jshrink", - "version": "v1.7.0", - "version_normalized": "1.7.0.0", + "version": "v1.8.0", + "version_normalized": "1.8.0.0", "source": { "type": "git", "url": "https://github.com/tedious/JShrink.git", - "reference": "7a35f5a4651ca2ce77295eb8a3b4e133ba47e19e" + "reference": "29ee510d684c22060040f4260a527206eb8199f1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/tedious/JShrink/zipball/7a35f5a4651ca2ce77295eb8a3b4e133ba47e19e", - "reference": "7a35f5a4651ca2ce77295eb8a3b4e133ba47e19e", + "url": "https://api.github.com/repos/tedious/JShrink/zipball/29ee510d684c22060040f4260a527206eb8199f1", + "reference": "29ee510d684c22060040f4260a527206eb8199f1", "shasum": "" }, "require": { @@ -4413,7 +4417,7 @@ "php-coveralls/php-coveralls": "^2.5.0", "phpunit/phpunit": "^9|^10" }, - "time": "2023-10-04T17:23:23+00:00", + "time": "2025-07-28T17:09:23+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -4439,7 +4443,7 @@ ], "support": { "issues": "https://github.com/tedious/JShrink/issues", - "source": "https://github.com/tedious/JShrink/tree/v1.7.0" + "source": "https://github.com/tedious/JShrink/tree/v1.8.0" }, "funding": [ { diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index d94529b..6145158 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => 'icinga/icinga-php-thirdparty', 'pretty_version' => 'dev-main', 'version' => 'dev-main', - 'reference' => 'a3a9a0f9a8449974ad52dcfbd5b1f1512e6e8bdb', + 'reference' => 'f51759aeef363058b1f12456a2ee6ffbb45cb25d', 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -11,9 +11,9 @@ ), 'versions' => array( 'brick/math' => array( - 'pretty_version' => '0.13.1', - 'version' => '0.13.1.0', - 'reference' => 'fc7ed316430118cc7836bf45faff18d5dfc8de04', + 'pretty_version' => '0.14.0', + 'version' => '0.14.0.0', + 'reference' => '113a8ee2656b882d4c3164fa31aa6e12cbb7aaa2', 'type' => 'library', 'install_path' => __DIR__ . '/../brick/math', 'aliases' => array(), @@ -236,27 +236,27 @@ 'dev_requirement' => false, ), 'guzzlehttp/guzzle' => array( - 'pretty_version' => '7.9.3', - 'version' => '7.9.3.0', - 'reference' => '7b2f29fe81dc4da0ca0ea7d42107a0845946ea77', + 'pretty_version' => '7.10.0', + 'version' => '7.10.0.0', + 'reference' => 'b51ac707cfa420b7bfd4e4d5e510ba8008e822b4', 'type' => 'library', 'install_path' => __DIR__ . '/../guzzlehttp/guzzle', 'aliases' => array(), 'dev_requirement' => false, ), 'guzzlehttp/promises' => array( - 'pretty_version' => '2.2.0', - 'version' => '2.2.0.0', - 'reference' => '7c69f28996b0a6920945dd20b3857e499d9ca96c', + 'pretty_version' => '2.3.0', + 'version' => '2.3.0.0', + 'reference' => '481557b130ef3790cf82b713667b43030dc9c957', 'type' => 'library', 'install_path' => __DIR__ . '/../guzzlehttp/promises', 'aliases' => array(), 'dev_requirement' => false, ), 'guzzlehttp/psr7' => array( - 'pretty_version' => '2.7.1', - 'version' => '2.7.1.0', - 'reference' => 'c2270caaabe631b3b44c85f99e5a04bbb8060d16', + 'pretty_version' => '2.8.0', + 'version' => '2.8.0.0', + 'reference' => '21dc724a0583619cd1652f673303492272778051', 'type' => 'library', 'install_path' => __DIR__ . '/../guzzlehttp/psr7', 'aliases' => array(), @@ -265,7 +265,7 @@ 'icinga/icinga-php-thirdparty' => array( 'pretty_version' => 'dev-main', 'version' => 'dev-main', - 'reference' => 'a3a9a0f9a8449974ad52dcfbd5b1f1512e6e8bdb', + 'reference' => 'f51759aeef363058b1f12456a2ee6ffbb45cb25d', 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -323,9 +323,9 @@ ), ), 'predis/predis' => array( - 'pretty_version' => 'v3.0.1', - 'version' => '3.0.1.0', - 'reference' => '34fb0a7da0330df1bab4280fcac4afdeeccc3edf', + 'pretty_version' => 'v3.2.0', + 'version' => '3.2.0.0', + 'reference' => 'c1845d96ccbceb1269387d1c294fd7e4876f6307', 'type' => 'library', 'install_path' => __DIR__ . '/../predis/predis', 'aliases' => array(), @@ -404,9 +404,9 @@ 'dev_requirement' => false, ), 'ramsey/uuid' => array( - 'pretty_version' => '4.9.0', - 'version' => '4.9.0.0', - 'reference' => '4e0e23cc785f0724a0e838279a9eb03f28b092a0', + 'pretty_version' => '4.9.1', + 'version' => '4.9.1.0', + 'reference' => '81f941f6f729b1e3ceea61d9d014f8b6c6800440', 'type' => 'library', 'install_path' => __DIR__ . '/../ramsey/uuid', 'aliases' => array(), @@ -514,7 +514,7 @@ 'rhumsaa/uuid' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '4.9.0', + 0 => '4.9.1', ), ), 'ringcentral/psr7' => array( @@ -581,8 +581,8 @@ 'dev_requirement' => false, ), 'symfony/polyfill-php81' => array( - 'pretty_version' => 'v1.32.0', - 'version' => '1.32.0.0', + 'pretty_version' => 'v1.33.0', + 'version' => '1.33.0.0', 'reference' => '4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/polyfill-php81', @@ -608,9 +608,9 @@ 'dev_requirement' => false, ), 'tedivm/jshrink' => array( - 'pretty_version' => 'v1.7.0', - 'version' => '1.7.0.0', - 'reference' => '7a35f5a4651ca2ce77295eb8a3b4e133ba47e19e', + 'pretty_version' => 'v1.8.0', + 'version' => '1.8.0.0', + 'reference' => '29ee510d684c22060040f4260a527206eb8199f1', 'type' => 'library', 'install_path' => __DIR__ . '/../tedivm/jshrink', 'aliases' => array(), diff --git a/vendor/composer/platform_check.php b/vendor/composer/platform_check.php index d32d90c..14bf88d 100644 --- a/vendor/composer/platform_check.php +++ b/vendor/composer/platform_check.php @@ -19,8 +19,7 @@ if ($issues) { echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL; } } - trigger_error( - 'Composer detected issues in your platform: ' . implode(' ', $issues), - E_USER_ERROR + throw new \RuntimeException( + 'Composer detected issues in your platform: ' . implode(' ', $issues) ); } diff --git a/vendor/guzzlehttp/guzzle/CHANGELOG.md b/vendor/guzzlehttp/guzzle/CHANGELOG.md index 7600ef4..5fe721e 100644 --- a/vendor/guzzlehttp/guzzle/CHANGELOG.md +++ b/vendor/guzzlehttp/guzzle/CHANGELOG.md @@ -2,6 +2,17 @@ Please refer to [UPGRADING](UPGRADING.md) guide for upgrading to a major version. +## 7.10.0 - 2025-08-23 + +### Added + +- Support for PHP 8.5 + +### Changed + +- Adjusted `guzzlehttp/promises` version constraint to `^2.3` +- Adjusted `guzzlehttp/psr7` version constraint to `^2.8` + ## 7.9.3 - 2025-03-27 diff --git a/vendor/guzzlehttp/guzzle/composer.json b/vendor/guzzlehttp/guzzle/composer.json index cbede14..0db75a9 100644 --- a/vendor/guzzlehttp/guzzle/composer.json +++ b/vendor/guzzlehttp/guzzle/composer.json @@ -81,8 +81,8 @@ "require": { "php": "^7.2.5 || ^8.0", "ext-json": "*", - "guzzlehttp/promises": "^1.5.3 || ^2.0.3", - "guzzlehttp/psr7": "^2.7.0", + "guzzlehttp/promises": "^2.3", + "guzzlehttp/psr7": "^2.8", "psr/http-client": "^1.0", "symfony/deprecation-contracts": "^2.2 || ^3.0" }, diff --git a/vendor/guzzlehttp/guzzle/package-lock.json b/vendor/guzzlehttp/guzzle/package-lock.json new file mode 100644 index 0000000..0e14dc1 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/package-lock.json @@ -0,0 +1,6 @@ +{ + "name": "guzzle", + "lockfileVersion": 3, + "requires": true, + "packages": {} +} diff --git a/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php b/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php index fe36137..3c1fa9c 100644 --- a/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php +++ b/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php @@ -125,7 +125,9 @@ class CurlFactory implements CurlFactoryInterface unset($easy->handle); if (\count($this->handles) >= $this->maxHandles) { - \curl_close($resource); + if (PHP_VERSION_ID < 80000) { + \curl_close($resource); + } } else { // Remove all callback functions as they can hold onto references // and are not cleaned up by curl_reset. Using curl_setopt_array @@ -729,7 +731,10 @@ class CurlFactory implements CurlFactoryInterface public function __destruct() { foreach ($this->handles as $id => $handle) { - \curl_close($handle); + if (PHP_VERSION_ID < 80000) { + \curl_close($handle); + } + unset($this->handles[$id]); } } diff --git a/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php b/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php index 73a6abe..21abbed 100644 --- a/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php +++ b/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php @@ -240,7 +240,10 @@ class CurlMultiHandler $handle = $this->handles[$id]['easy']->handle; unset($this->delays[$id], $this->handles[$id]); \curl_multi_remove_handle($this->_mh, $handle); - \curl_close($handle); + + if (PHP_VERSION_ID < 80000) { + \curl_close($handle); + } return true; } diff --git a/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php b/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php index 083049e..f24921f 100644 --- a/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php +++ b/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php @@ -333,8 +333,15 @@ class StreamHandler ); return $this->createResource( - function () use ($uri, &$http_response_header, $contextResource, $context, $options, $request) { + function () use ($uri, $contextResource, $context, $options, $request) { $resource = @\fopen((string) $uri, 'r', false, $contextResource); + + // See https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_the_http_response_header_predefined_variable + if (function_exists('http_get_last_response_headers')) { + /** @var array|null */ + $http_response_header = \http_get_last_response_headers(); + } + $this->lastHeaders = $http_response_header ?? []; if (false === $resource) { diff --git a/vendor/guzzlehttp/guzzle/src/Middleware.php b/vendor/guzzlehttp/guzzle/src/Middleware.php index 6edbb3f..9901da4 100644 --- a/vendor/guzzlehttp/guzzle/src/Middleware.php +++ b/vendor/guzzlehttp/guzzle/src/Middleware.php @@ -187,12 +187,12 @@ final class Middleware * Middleware that logs requests, responses, and errors using a message * formatter. * - * @phpstan-param \Psr\Log\LogLevel::* $logLevel Level at which to log requests. - * * @param LoggerInterface $logger Logs messages. * @param MessageFormatterInterface|MessageFormatter $formatter Formatter used to create message strings. * @param string $logLevel Level at which to log requests. * + * @phpstan-param \Psr\Log\LogLevel::* $logLevel Level at which to log requests. + * * @return callable Returns a function that accepts the next handler. */ public static function log(LoggerInterface $logger, $formatter, string $logLevel = 'info'): callable diff --git a/vendor/guzzlehttp/promises/CHANGELOG.md b/vendor/guzzlehttp/promises/CHANGELOG.md index 1d80450..7df9c0a 100644 --- a/vendor/guzzlehttp/promises/CHANGELOG.md +++ b/vendor/guzzlehttp/promises/CHANGELOG.md @@ -1,6 +1,13 @@ # CHANGELOG +## 2.3.0 - 2025-08-22 + +### Added + +- PHP 8.5 support + + ## 2.2.0 - 2025-03-27 ### Fixed diff --git a/vendor/guzzlehttp/promises/README.md b/vendor/guzzlehttp/promises/README.md index d1c814f..493a931 100644 --- a/vendor/guzzlehttp/promises/README.md +++ b/vendor/guzzlehttp/promises/README.md @@ -41,7 +41,7 @@ composer require guzzlehttp/promises | Version | Status | PHP Version | |---------|---------------------|--------------| | 1.x | Security fixes only | >=5.5,<8.3 | -| 2.x | Latest | >=7.2.5,<8.5 | +| 2.x | Latest | >=7.2.5,<8.6 | ## Quick Start diff --git a/vendor/guzzlehttp/promises/composer.json b/vendor/guzzlehttp/promises/composer.json index f64ed77..9d6e856 100644 --- a/vendor/guzzlehttp/promises/composer.json +++ b/vendor/guzzlehttp/promises/composer.json @@ -30,7 +30,7 @@ }, "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", - "phpunit/phpunit": "^8.5.39 || ^9.6.20" + "phpunit/phpunit": "^8.5.44 || ^9.6.25" }, "autoload": { "psr-4": { diff --git a/vendor/guzzlehttp/psr7/CHANGELOG.md b/vendor/guzzlehttp/psr7/CHANGELOG.md index a859295..4a2a121 100644 --- a/vendor/guzzlehttp/psr7/CHANGELOG.md +++ b/vendor/guzzlehttp/psr7/CHANGELOG.md @@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 2.8.0 - 2025-08-23 + +### Added + +- Allow empty lists as header values + +### Changed + +- PHP 8.5 support + ## 2.7.1 - 2025-03-27 ### Fixed diff --git a/vendor/guzzlehttp/psr7/README.md b/vendor/guzzlehttp/psr7/README.md index 2e9bb0b..24aad86 100644 --- a/vendor/guzzlehttp/psr7/README.md +++ b/vendor/guzzlehttp/psr7/README.md @@ -25,7 +25,7 @@ composer require guzzlehttp/psr7 | Version | Status | PHP Version | |---------|---------------------|--------------| | 1.x | EOL (2024-06-30) | >=5.4,<8.2 | -| 2.x | Latest | >=7.2.5,<8.5 | +| 2.x | Latest | >=7.2.5,<8.6 | ## AppendStream diff --git a/vendor/guzzlehttp/psr7/composer.json b/vendor/guzzlehttp/psr7/composer.json index 28d15f5..96098f5 100644 --- a/vendor/guzzlehttp/psr7/composer.json +++ b/vendor/guzzlehttp/psr7/composer.json @@ -62,7 +62,7 @@ "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", "http-interop/http-factory-tests": "0.9.0", - "phpunit/phpunit": "^8.5.39 || ^9.6.20" + "phpunit/phpunit": "^8.5.44 || ^9.6.25" }, "suggest": { "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" diff --git a/vendor/guzzlehttp/psr7/src/MessageTrait.php b/vendor/guzzlehttp/psr7/src/MessageTrait.php index 65dbc4b..c15ee63 100644 --- a/vendor/guzzlehttp/psr7/src/MessageTrait.php +++ b/vendor/guzzlehttp/psr7/src/MessageTrait.php @@ -174,10 +174,6 @@ trait MessageTrait return $this->trimAndValidateHeaderValues([$value]); } - if (count($value) === 0) { - throw new \InvalidArgumentException('Header value can not be an empty array.'); - } - return $this->trimAndValidateHeaderValues($value); } diff --git a/vendor/guzzlehttp/psr7/src/Utils.php b/vendor/guzzlehttp/psr7/src/Utils.php index 7682d2c..5451e3d 100644 --- a/vendor/guzzlehttp/psr7/src/Utils.php +++ b/vendor/guzzlehttp/psr7/src/Utils.php @@ -397,7 +397,7 @@ final class Utils restore_error_handler(); if ($ex) { - /** @var $ex \RuntimeException */ + /** @var \RuntimeException $ex */ throw $ex; } @@ -444,7 +444,7 @@ final class Utils restore_error_handler(); if ($ex) { - /** @var $ex \RuntimeException */ + /** @var \RuntimeException $ex */ throw $ex; } diff --git a/vendor/predis/predis/README.md b/vendor/predis/predis/README.md index 8196b62..276baa5 100644 --- a/vendor/predis/predis/README.md +++ b/vendor/predis/predis/README.md @@ -138,6 +138,50 @@ it is still desired to have control of when the connection is opened or closed: achieved by invoking `$client->connect()` and `$client->disconnect()`. Please note that the effect of these methods on aggregate connections may differ depending on each specific implementation. +#### Persistent connections #### + +To increase a performance of your application you may set up a client to use persistent TCP connection, this way +client saves a time on socket creation and connection handshake. By default, connection is created on first-command +execution and will be automatically closed by GC before the process is being killed. +However, if your application is backed by PHP-FPM the processes are idle, and you may set up it to be persistent and +reusable across multiple script execution within the same process. + +To enable the persistent connection mode you should provide following configuration: + +```php +// Standalone +$client = new Predis\Client(['persistent' => true]); + +// Cluster +$client = new Predis\Client( + ['tcp://host:port', 'tcp://host:port', 'tcp://host:port'], + ['cluster' => 'redis', 'parameters' => ['persistent' => true]] +); +``` + +**Important** + +If you operate on multiple clients within the same application, and they communicate with the same resource, by default +they will share the same socket (that's the default behaviour of persistent sockets). So in this case you would need +to additionally provide a `conn_uid` identifier for each client, this way each client will create its own socket so +the connection context won't be shared across clients. This socket behaviour explained +[here](https://www.php.net/manual/en/function.stream-socket-client.php#105393) + +```php +// Standalone +$client1 = new Predis\Client(['persistent' => true, 'conn_uid' => 'id_1']); +$client2 = new Predis\Client(['persistent' => true, 'conn_uid' => 'id_2']); + +// Cluster +$client1 = new Predis\Client( + ['tcp://host:port', 'tcp://host:port', 'tcp://host:port'], + ['cluster' => 'redis', 'parameters' => ['persistent' => true, 'conn_uid' => 'id_1']] +); +$client2 = new Predis\Client( + ['tcp://host:port', 'tcp://host:port', 'tcp://host:port'], + ['cluster' => 'redis', 'parameters' => ['persistent' => true, 'conn_uid' => 'id_2']] +); +``` ### Client configuration ### diff --git a/vendor/predis/predis/src/Client.php b/vendor/predis/predis/src/Client.php index 7ccaf6a..e9b6888 100644 --- a/vendor/predis/predis/src/Client.php +++ b/vendor/predis/predis/src/Client.php @@ -54,7 +54,7 @@ use Traversable; */ class Client implements ClientInterface, IteratorAggregate { - public const VERSION = '3.0.1'; + public const VERSION = '3.1.1-dev'; /** @var OptionsInterface */ private $options; diff --git a/vendor/predis/predis/src/ClientContextInterface.php b/vendor/predis/predis/src/ClientContextInterface.php index 01681e4..a5eaa4e 100644 --- a/vendor/predis/predis/src/ClientContextInterface.php +++ b/vendor/predis/predis/src/ClientContextInterface.php @@ -45,6 +45,7 @@ use Predis\Command\Container\Json\JSONDEBUG; use Predis\Command\Container\Search\FTCONFIG; use Predis\Command\Container\Search\FTCURSOR; use Predis\Command\Container\XGROUP; +use Predis\Command\Redis\VADD; /** * Interface defining a client-side context such as a pipeline or transaction. @@ -283,6 +284,21 @@ use Predis\Command\Container\XGROUP; * @method $this tsqueryindex(string ...$filterExpression) * @method $this tsrange(string $key, $fromTimestamp, $toTimestamp, ?RangeArguments $arguments = null) * @method $this tsrevrange(string $key, $fromTimestamp, $toTimestamp, ?RangeArguments $arguments = null) + * @method $this xack(string $key, string $group, string ...$id) + * @method $this xackdel(string $key, string $group, string $mode, array $ids) + * @method $this xadd(string $key, array $dictionary, string $id = '*', array $options = null) + * @method $this xautoclaim(string $key, string $group, string $consumer, int $minIdleTime, string $start, ?int $count = null, bool $justId = false) + * @method $this xclaim(string $key, string $group, string $consumer, int $minIdleTime, string|array $ids, ?int $idle = null, ?int $time = null, ?int $retryCount = null, bool $force = false, bool $justId = false, ?string $lastId = null) + * @method $this xdel(string $key, string ...$id) + * @method $this xdelex(string $key, string $mode, array $ids) + * @method $this xlen(string $key) + * @method $this xpending(string $key, string $group, ?int $minIdleTime = null, ?string $start = null, ?string $end = null, ?int $count = null, ?string $consumer = null) + * @method $this xrevrange(string $key, string $end, string $start, ?int $count = null) + * @method $this xrange(string $key, string $start, string $end, ?int $count = null) + * @method $this xread(int $count = null, int $block = null, array $streams = null, string ...$id) + * @method $this xreadgroup(string $group, string $consumer, ?int $count = null, ?int $blockMs = null, bool $noAck = false, string ...$keyOrId) + * @method $this xsetid(string $key, string $lastId, ?int $entriesAdded = null, ?string $maxDeleteId = null) + * @method $this xtrim(string $key, array|string $strategy, string $threshold, array $options = null) * @method $this zadd($key, array $membersAndScoresDictionary) * @method $this zcard($key) * @method $this zcount($key, $min, $max) @@ -325,6 +341,17 @@ use Predis\Command\Container\XGROUP; * @method $this unwatch() * @method $this waitaof(int $numLocal, int $numReplicas, int $timeout) * @method $this unsubscribe(string ...$channels) + * @method $this vadd(string $key, string|array $vector, string $elem, int $dim = null, bool $cas = false, string $quant = VADD::QUANT_DEFAULT, ?int $BEF = null, string|array $attributes = null, int $numlinks = null) + * @method $this vcard(string $key) + * @method $this vdim(int $key) + * @method $this vemb(string $key, string $elem, bool $raw = false) + * @method $this vgetattr(string $key, string $elem, bool $asJson = false) + * @method $this vinfo(string $key) + * @method $this vlinks(string $key, string $elem, bool $withScores = false) + * @method $this vrandmember(string $key, int $count = null) + * @method $this vrem(string $key, string $elem) + * @method $this vsetattr(string $key, string $elem, string|array $attributes) + * @method $this vsim(string $key, string|array $vectorOrElem, bool $isElem = false, bool $withScores = false, int $count = null, float $epsilon = null, int $ef = null, string $filter = null, int $filterEf = null, bool $truth = false, bool $noThread = false) * @method $this watch($key) * @method $this eval($script, $numkeys, $keyOrArg1 = null, $keyOrArgN = null) * @method $this eval_ro(string $script, array $keys, ...$argument) diff --git a/vendor/predis/predis/src/ClientInterface.php b/vendor/predis/predis/src/ClientInterface.php index 178b3e4..cbaaaf2 100644 --- a/vendor/predis/predis/src/ClientInterface.php +++ b/vendor/predis/predis/src/ClientInterface.php @@ -47,6 +47,7 @@ use Predis\Command\Container\Search\FTCURSOR; use Predis\Command\Container\XGROUP; use Predis\Command\Container\XINFO; use Predis\Command\FactoryInterface; +use Predis\Command\Redis\VADD; use Predis\Configuration\OptionsInterface; use Predis\Connection\ConnectionInterface; use Predis\Response\Status; @@ -294,18 +295,24 @@ use Predis\Response\Status; * @method array tsqueryindex(string ...$filterExpression) * @method array tsrange(string $key, $fromTimestamp, $toTimestamp, ?RangeArguments $arguments = null) * @method array tsrevrange(string $key, $fromTimestamp, $toTimestamp, ?RangeArguments $arguments = null) + * @method int xack(string $key, string $group, string ...$id) + * @method array xackdel(string $key, string $group, string $mode, array $ids) * @method string xadd(string $key, array $dictionary, string $id = '*', array $options = null) * @method array xautoclaim(string $key, string $group, string $consumer, int $minIdleTime, string $start, ?int $count = null, bool $justId = false) + * @method array xclaim(string $key, string $group, string $consumer, int $minIdleTime, string|array $ids, ?int $idle = null, ?int $time = null, ?int $retryCount = null, bool $force = false, bool $justId = false, ?string $lastId = null) * @method int xdel(string $key, string ...$id) + * @method array xdelex(string $key, string $mode, array $ids) * @method int xlen(string $key) + * @method array xpending(string $key, string $group, ?int $minIdleTime = null, ?string $start = null, ?string $end = null, ?int $count = null, ?string $consumer = null) * @method array xrevrange(string $key, string $end, string $start, ?int $count = null) * @method array xrange(string $key, string $start, string $end, ?int $count = null) * @method array|null xread(int $count = null, int $block = null, array $streams = null, string ...$id) * @method array xreadgroup(string $group, string $consumer, ?int $count = null, ?int $blockMs = null, bool $noAck = false, string ...$keyOrId) + * @method Status xsetid(string $key, string $lastId, ?int $entriesAdded = null, ?string $maxDeleteId = null) * @method string xtrim(string $key, array|string $strategy, string $threshold, array $options = null) * @method int zadd(string $key, array $membersAndScoresDictionary) * @method int zcard(string $key) - * @method string zcount(string $key, int|string $min, int|string $max) + * @method int zcount(string $key, int|string $min, int|string $max) * @method array zdiff(array $keys, bool $withScores = false) * @method int zdiffstore(string $destination, array $keys) * @method string zincrby(string $key, int $increment, string $member) @@ -346,6 +353,17 @@ use Predis\Response\Status; * @method mixed multi() * @method mixed unwatch() * @method array unsubscribe(string ...$channels) + * @method bool vadd(string $key, string|array $vector, string $elem, int $dim = null, bool $cas = false, string $quant = VADD::QUANT_DEFAULT, int $bef = null, string|array $attributes = null, int $numlinks = null) + * @method int vcard(string $key) + * @method int vdim(string $key) + * @method array vemb(string $key, string $elem, bool $raw = false) + * @method string|array|null vgetattr(string $key, string $elem, bool $asJson = false) + * @method array|null vinfo(string $key) + * @method array|null vlinks(string $key, string $elem, bool $withScores = false) + * @method string|array|null vrandmember(string $key, int $count = null) + * @method bool vrem(string $key, string $elem) + * @method array vsim(string $key, string|array $vectorOrElem, bool $isElem = false, bool $withScores = false, int $count = null, float $epsilon = null, int $ef = null, string $filter = null, int $filterEf = null, bool $truth = false, bool $noThread = false) + * @method bool vsetattr(string $key, string $elem, string|array $attributes) * @method array waitaof(int $numLocal, int $numReplicas, int $timeout) * @method mixed watch(string[]|string $keyOrKeys) * @method mixed eval(string $script, int $numkeys, string ...$keyOrArg = null) diff --git a/vendor/predis/predis/src/Command/PrefixableCommand.php b/vendor/predis/predis/src/Command/PrefixableCommand.php index f531f6d..cf74151 100644 --- a/vendor/predis/predis/src/Command/PrefixableCommand.php +++ b/vendor/predis/predis/src/Command/PrefixableCommand.php @@ -32,7 +32,7 @@ abstract class PrefixableCommand extends Command implements PrefixableCommandInt */ public function applyPrefixForAllArguments(string $prefix): void { - $this->setArguments( + $this->setRawArguments( array_map(static function ($key) use ($prefix) { return $prefix . $key; }, $this->getArguments()) @@ -49,7 +49,7 @@ abstract class PrefixableCommand extends Command implements PrefixableCommandInt { $arguments = $this->getArguments(); $arguments[0] = $prefix . $arguments[0]; - $this->setArguments($arguments); + $this->setRawArguments($arguments); } /** diff --git a/vendor/predis/predis/src/Command/Redis/BITOP.php b/vendor/predis/predis/src/Command/Redis/BITOP.php index 8dc6881..b0a1d73 100644 --- a/vendor/predis/predis/src/Command/Redis/BITOP.php +++ b/vendor/predis/predis/src/Command/Redis/BITOP.php @@ -12,6 +12,7 @@ namespace Predis\Command\Redis; +use InvalidArgumentException; use Predis\Command\PrefixableCommand as RedisCommand; /** @@ -19,6 +20,8 @@ use Predis\Command\PrefixableCommand as RedisCommand; */ class BITOP extends RedisCommand { + private const VALID_OPERATIONS = ['AND', 'OR', 'XOR', 'NOT', 'DIFF', 'DIFF1', 'ANDOR', 'ONE']; + /** * {@inheritdoc} */ @@ -38,6 +41,13 @@ class BITOP extends RedisCommand array_unshift($arguments, $operation, $destination); } + if (!empty($arguments)) { + $operation = strtoupper($arguments[0]); + if (!in_array($operation, self::VALID_OPERATIONS, false)) { + throw new InvalidArgumentException('BITOP operation must be one of: AND, OR, XOR, NOT, DIFF, DIFF1, ANDOR, ONE'); + } + } + parent::setArguments($arguments); } diff --git a/vendor/predis/predis/src/Command/Redis/BloomFilter/BFADD.php b/vendor/predis/predis/src/Command/Redis/BloomFilter/BFADD.php index 34e095d..07fe6af 100644 --- a/vendor/predis/predis/src/Command/Redis/BloomFilter/BFADD.php +++ b/vendor/predis/predis/src/Command/Redis/BloomFilter/BFADD.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\BloomFilter; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/bf.add/ @@ -26,4 +26,9 @@ class BFADD extends RedisCommand { return 'BF.ADD'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/BloomFilter/BFEXISTS.php b/vendor/predis/predis/src/Command/Redis/BloomFilter/BFEXISTS.php index 3d2ef6e..de25ab4 100644 --- a/vendor/predis/predis/src/Command/Redis/BloomFilter/BFEXISTS.php +++ b/vendor/predis/predis/src/Command/Redis/BloomFilter/BFEXISTS.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\BloomFilter; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/bf.exists/ @@ -25,4 +25,9 @@ class BFEXISTS extends RedisCommand { return 'BF.EXISTS'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/BloomFilter/BFINFO.php b/vendor/predis/predis/src/Command/Redis/BloomFilter/BFINFO.php index b0d5322..a2832c4 100644 --- a/vendor/predis/predis/src/Command/Redis/BloomFilter/BFINFO.php +++ b/vendor/predis/predis/src/Command/Redis/BloomFilter/BFINFO.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\BloomFilter; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; use UnexpectedValueException; /** @@ -76,4 +76,9 @@ class BFINFO extends RedisCommand return $data; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/BloomFilter/BFINSERT.php b/vendor/predis/predis/src/Command/Redis/BloomFilter/BFINSERT.php index 0efcdcc..6825cbf 100644 --- a/vendor/predis/predis/src/Command/Redis/BloomFilter/BFINSERT.php +++ b/vendor/predis/predis/src/Command/Redis/BloomFilter/BFINSERT.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\BloomFilter; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; use Predis\Command\Traits\BloomFilters\Capacity; use Predis\Command\Traits\BloomFilters\Error; use Predis\Command\Traits\BloomFilters\Expansion; @@ -48,6 +48,11 @@ class BFINSERT extends RedisCommand return 'BF.INSERT'; } + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } + public function setArguments(array $arguments) { $this->setNoCreate($arguments); diff --git a/vendor/predis/predis/src/Command/Redis/BloomFilter/BFLOADCHUNK.php b/vendor/predis/predis/src/Command/Redis/BloomFilter/BFLOADCHUNK.php index 6c6b88a..747fef3 100644 --- a/vendor/predis/predis/src/Command/Redis/BloomFilter/BFLOADCHUNK.php +++ b/vendor/predis/predis/src/Command/Redis/BloomFilter/BFLOADCHUNK.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\BloomFilter; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/bf.loadchunk/ @@ -25,4 +25,9 @@ class BFLOADCHUNK extends RedisCommand { return 'BF.LOADCHUNK'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/BloomFilter/BFMADD.php b/vendor/predis/predis/src/Command/Redis/BloomFilter/BFMADD.php index a77c9f5..c672e0d 100644 --- a/vendor/predis/predis/src/Command/Redis/BloomFilter/BFMADD.php +++ b/vendor/predis/predis/src/Command/Redis/BloomFilter/BFMADD.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\BloomFilter; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/bf.madd/ @@ -26,4 +26,9 @@ class BFMADD extends RedisCommand { return 'BF.MADD'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/BloomFilter/BFMEXISTS.php b/vendor/predis/predis/src/Command/Redis/BloomFilter/BFMEXISTS.php index 53e000f..80d88b5 100644 --- a/vendor/predis/predis/src/Command/Redis/BloomFilter/BFMEXISTS.php +++ b/vendor/predis/predis/src/Command/Redis/BloomFilter/BFMEXISTS.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\BloomFilter; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/bf.mexists/ @@ -25,4 +25,9 @@ class BFMEXISTS extends RedisCommand { return 'BF.MEXISTS'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/BloomFilter/BFRESERVE.php b/vendor/predis/predis/src/Command/Redis/BloomFilter/BFRESERVE.php index d2098c0..7340021 100644 --- a/vendor/predis/predis/src/Command/Redis/BloomFilter/BFRESERVE.php +++ b/vendor/predis/predis/src/Command/Redis/BloomFilter/BFRESERVE.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\BloomFilter; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; use Predis\Command\Traits\BloomFilters\Expansion; /** @@ -46,4 +46,9 @@ class BFRESERVE extends RedisCommand $this->setExpansion($arguments); $this->filterArguments(); } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/BloomFilter/BFSCANDUMP.php b/vendor/predis/predis/src/Command/Redis/BloomFilter/BFSCANDUMP.php index 10206e8..f66898c 100644 --- a/vendor/predis/predis/src/Command/Redis/BloomFilter/BFSCANDUMP.php +++ b/vendor/predis/predis/src/Command/Redis/BloomFilter/BFSCANDUMP.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\BloomFilter; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/bf.scandump/ @@ -26,4 +26,9 @@ class BFSCANDUMP extends RedisCommand { return 'BF.SCANDUMP'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/CountMinSketch/CMSINCRBY.php b/vendor/predis/predis/src/Command/Redis/CountMinSketch/CMSINCRBY.php index b7513f7..5e0e473 100644 --- a/vendor/predis/predis/src/Command/Redis/CountMinSketch/CMSINCRBY.php +++ b/vendor/predis/predis/src/Command/Redis/CountMinSketch/CMSINCRBY.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\CountMinSketch; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/cms.incrby/ @@ -26,4 +26,9 @@ class CMSINCRBY extends RedisCommand { return 'CMS.INCRBY'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/CountMinSketch/CMSINFO.php b/vendor/predis/predis/src/Command/Redis/CountMinSketch/CMSINFO.php index 3dcad4b..25da51c 100644 --- a/vendor/predis/predis/src/Command/Redis/CountMinSketch/CMSINFO.php +++ b/vendor/predis/predis/src/Command/Redis/CountMinSketch/CMSINFO.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\CountMinSketch; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/cms.info/ @@ -42,4 +42,9 @@ class CMSINFO extends RedisCommand return $data; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/CountMinSketch/CMSINITBYDIM.php b/vendor/predis/predis/src/Command/Redis/CountMinSketch/CMSINITBYDIM.php index f136e9f..90bcbdc 100644 --- a/vendor/predis/predis/src/Command/Redis/CountMinSketch/CMSINITBYDIM.php +++ b/vendor/predis/predis/src/Command/Redis/CountMinSketch/CMSINITBYDIM.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\CountMinSketch; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/cms.initbydim/ @@ -25,4 +25,9 @@ class CMSINITBYDIM extends RedisCommand { return 'CMS.INITBYDIM'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/CountMinSketch/CMSINITBYPROB.php b/vendor/predis/predis/src/Command/Redis/CountMinSketch/CMSINITBYPROB.php index 0a6ec3a..597f5ed 100644 --- a/vendor/predis/predis/src/Command/Redis/CountMinSketch/CMSINITBYPROB.php +++ b/vendor/predis/predis/src/Command/Redis/CountMinSketch/CMSINITBYPROB.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\CountMinSketch; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/cms.initbyprob/ @@ -25,4 +25,9 @@ class CMSINITBYPROB extends RedisCommand { return 'CMS.INITBYPROB'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/CountMinSketch/CMSMERGE.php b/vendor/predis/predis/src/Command/Redis/CountMinSketch/CMSMERGE.php index b2942a6..51f619c 100644 --- a/vendor/predis/predis/src/Command/Redis/CountMinSketch/CMSMERGE.php +++ b/vendor/predis/predis/src/Command/Redis/CountMinSketch/CMSMERGE.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\CountMinSketch; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/cms.merge/ @@ -39,4 +39,17 @@ class CMSMERGE extends RedisCommand parent::setArguments($processedArguments); } + + public function prefixKeys($prefix) + { + if ($arguments = $this->getArguments()) { + $arguments[0] = $prefix . $arguments[0]; + + for ($i = 2, $iMax = (int) $arguments[1] + 2; $i < $iMax; $i++) { + $arguments[$i] = $prefix . $arguments[$i]; + } + + $this->setRawArguments($arguments); + } + } } diff --git a/vendor/predis/predis/src/Command/Redis/CountMinSketch/CMSQUERY.php b/vendor/predis/predis/src/Command/Redis/CountMinSketch/CMSQUERY.php index f4bdcbe..0c97c8c 100644 --- a/vendor/predis/predis/src/Command/Redis/CountMinSketch/CMSQUERY.php +++ b/vendor/predis/predis/src/Command/Redis/CountMinSketch/CMSQUERY.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\CountMinSketch; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/cms.query/ @@ -25,4 +25,9 @@ class CMSQUERY extends RedisCommand { return 'CMS.QUERY'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/CuckooFilter/CFADD.php b/vendor/predis/predis/src/Command/Redis/CuckooFilter/CFADD.php index deba1c2..9c638e4 100644 --- a/vendor/predis/predis/src/Command/Redis/CuckooFilter/CFADD.php +++ b/vendor/predis/predis/src/Command/Redis/CuckooFilter/CFADD.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\CuckooFilter; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/cf.add/ @@ -25,4 +25,9 @@ class CFADD extends RedisCommand { return 'CF.ADD'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/CuckooFilter/CFADDNX.php b/vendor/predis/predis/src/Command/Redis/CuckooFilter/CFADDNX.php index f395de6..4ef2bfe 100644 --- a/vendor/predis/predis/src/Command/Redis/CuckooFilter/CFADDNX.php +++ b/vendor/predis/predis/src/Command/Redis/CuckooFilter/CFADDNX.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\CuckooFilter; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/cf.addnx/ @@ -25,4 +25,9 @@ class CFADDNX extends RedisCommand { return 'CF.ADDNX'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/CuckooFilter/CFCOUNT.php b/vendor/predis/predis/src/Command/Redis/CuckooFilter/CFCOUNT.php index 0ff664b..b4dd0b2 100644 --- a/vendor/predis/predis/src/Command/Redis/CuckooFilter/CFCOUNT.php +++ b/vendor/predis/predis/src/Command/Redis/CuckooFilter/CFCOUNT.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\CuckooFilter; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/cf.count/ @@ -26,4 +26,9 @@ class CFCOUNT extends RedisCommand { return 'CF.COUNT'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/CuckooFilter/CFDEL.php b/vendor/predis/predis/src/Command/Redis/CuckooFilter/CFDEL.php index 39db921..6e60b18 100644 --- a/vendor/predis/predis/src/Command/Redis/CuckooFilter/CFDEL.php +++ b/vendor/predis/predis/src/Command/Redis/CuckooFilter/CFDEL.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\CuckooFilter; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/cf.del/ @@ -27,4 +27,9 @@ class CFDEL extends RedisCommand { return 'CF.DEL'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/CuckooFilter/CFEXISTS.php b/vendor/predis/predis/src/Command/Redis/CuckooFilter/CFEXISTS.php index 9ea7f42..8c5cfce 100644 --- a/vendor/predis/predis/src/Command/Redis/CuckooFilter/CFEXISTS.php +++ b/vendor/predis/predis/src/Command/Redis/CuckooFilter/CFEXISTS.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\CuckooFilter; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/cf.exists/ @@ -25,4 +25,9 @@ class CFEXISTS extends RedisCommand { return 'CF.EXISTS'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/CuckooFilter/CFINFO.php b/vendor/predis/predis/src/Command/Redis/CuckooFilter/CFINFO.php index 7a2bcd9..55d49d0 100644 --- a/vendor/predis/predis/src/Command/Redis/CuckooFilter/CFINFO.php +++ b/vendor/predis/predis/src/Command/Redis/CuckooFilter/CFINFO.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\CuckooFilter; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/cf.info/ @@ -42,4 +42,9 @@ class CFINFO extends RedisCommand return $data; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/CuckooFilter/CFINSERT.php b/vendor/predis/predis/src/Command/Redis/CuckooFilter/CFINSERT.php index 009dfc4..4c32aad 100644 --- a/vendor/predis/predis/src/Command/Redis/CuckooFilter/CFINSERT.php +++ b/vendor/predis/predis/src/Command/Redis/CuckooFilter/CFINSERT.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\CuckooFilter; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; use Predis\Command\Traits\BloomFilters\Capacity; use Predis\Command\Traits\BloomFilters\Items; use Predis\Command\Traits\BloomFilters\NoCreate; @@ -49,4 +49,9 @@ class CFINSERT extends RedisCommand $this->setCapacity($arguments); $this->filterArguments(); } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/CuckooFilter/CFLOADCHUNK.php b/vendor/predis/predis/src/Command/Redis/CuckooFilter/CFLOADCHUNK.php index b702781..737c4c2 100644 --- a/vendor/predis/predis/src/Command/Redis/CuckooFilter/CFLOADCHUNK.php +++ b/vendor/predis/predis/src/Command/Redis/CuckooFilter/CFLOADCHUNK.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\CuckooFilter; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/cf.loadchunk/ @@ -26,4 +26,9 @@ class CFLOADCHUNK extends RedisCommand { return 'CF.LOADCHUNK'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/CuckooFilter/CFMEXISTS.php b/vendor/predis/predis/src/Command/Redis/CuckooFilter/CFMEXISTS.php index cd60129..f8ae03a 100644 --- a/vendor/predis/predis/src/Command/Redis/CuckooFilter/CFMEXISTS.php +++ b/vendor/predis/predis/src/Command/Redis/CuckooFilter/CFMEXISTS.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\CuckooFilter; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/cf.mexists/ @@ -25,4 +25,9 @@ class CFMEXISTS extends RedisCommand { return 'CF.MEXISTS'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/CuckooFilter/CFRESERVE.php b/vendor/predis/predis/src/Command/Redis/CuckooFilter/CFRESERVE.php index 9b606eb..0b6afce 100644 --- a/vendor/predis/predis/src/Command/Redis/CuckooFilter/CFRESERVE.php +++ b/vendor/predis/predis/src/Command/Redis/CuckooFilter/CFRESERVE.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\CuckooFilter; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; use Predis\Command\Traits\BloomFilters\BucketSize; use Predis\Command\Traits\BloomFilters\Expansion; use Predis\Command\Traits\BloomFilters\MaxIterations; @@ -49,4 +49,9 @@ class CFRESERVE extends RedisCommand $this->setBucketSize($arguments); $this->filterArguments(); } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/CuckooFilter/CFSCANDUMP.php b/vendor/predis/predis/src/Command/Redis/CuckooFilter/CFSCANDUMP.php index cb98deb..d37c19f 100644 --- a/vendor/predis/predis/src/Command/Redis/CuckooFilter/CFSCANDUMP.php +++ b/vendor/predis/predis/src/Command/Redis/CuckooFilter/CFSCANDUMP.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\CuckooFilter; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/cf.scandump/ @@ -26,4 +26,9 @@ class CFSCANDUMP extends RedisCommand { return 'CF.SCANDUMP'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/EXPIRETIME.php b/vendor/predis/predis/src/Command/Redis/EXPIRETIME.php index 6e3cb12..ec5c722 100644 --- a/vendor/predis/predis/src/Command/Redis/EXPIRETIME.php +++ b/vendor/predis/predis/src/Command/Redis/EXPIRETIME.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/expiretime/ @@ -26,4 +26,9 @@ class EXPIRETIME extends RedisCommand { return 'EXPIRETIME'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/GEOSEARCH.php b/vendor/predis/predis/src/Command/Redis/GEOSEARCH.php index 89529f6..d4fe046 100644 --- a/vendor/predis/predis/src/Command/Redis/GEOSEARCH.php +++ b/vendor/predis/predis/src/Command/Redis/GEOSEARCH.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; use Predis\Command\Traits\By\GeoBy; use Predis\Command\Traits\Count; use Predis\Command\Traits\From\GeoFrom; @@ -119,4 +119,9 @@ class GEOSEARCH extends RedisCommand return $parsedData; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/GETDEL.php b/vendor/predis/predis/src/Command/Redis/GETDEL.php index 283ba1b..8220a70 100644 --- a/vendor/predis/predis/src/Command/Redis/GETDEL.php +++ b/vendor/predis/predis/src/Command/Redis/GETDEL.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; class GETDEL extends RedisCommand { @@ -20,4 +20,9 @@ class GETDEL extends RedisCommand { return 'GETDEL'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/Json/JSONARRAPPEND.php b/vendor/predis/predis/src/Command/Redis/Json/JSONARRAPPEND.php index 12ca3f8..5f8bdba 100644 --- a/vendor/predis/predis/src/Command/Redis/Json/JSONARRAPPEND.php +++ b/vendor/predis/predis/src/Command/Redis/Json/JSONARRAPPEND.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\Json; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/json.arrappend/ @@ -25,4 +25,9 @@ class JSONARRAPPEND extends RedisCommand { return 'JSON.ARRAPPEND'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/Json/JSONARRINDEX.php b/vendor/predis/predis/src/Command/Redis/Json/JSONARRINDEX.php index 9710df2..ea157ec 100644 --- a/vendor/predis/predis/src/Command/Redis/Json/JSONARRINDEX.php +++ b/vendor/predis/predis/src/Command/Redis/Json/JSONARRINDEX.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\Json; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/json.arrindex/ @@ -25,4 +25,9 @@ class JSONARRINDEX extends RedisCommand { return 'JSON.ARRINDEX'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/Json/JSONARRINSERT.php b/vendor/predis/predis/src/Command/Redis/Json/JSONARRINSERT.php index 719aad7..c2029c3 100644 --- a/vendor/predis/predis/src/Command/Redis/Json/JSONARRINSERT.php +++ b/vendor/predis/predis/src/Command/Redis/Json/JSONARRINSERT.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\Json; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/json.arrinsert/ @@ -25,4 +25,9 @@ class JSONARRINSERT extends RedisCommand { return 'JSON.ARRINSERT'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/Json/JSONARRLEN.php b/vendor/predis/predis/src/Command/Redis/Json/JSONARRLEN.php index 8fb13dd..e945097 100644 --- a/vendor/predis/predis/src/Command/Redis/Json/JSONARRLEN.php +++ b/vendor/predis/predis/src/Command/Redis/Json/JSONARRLEN.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\Json; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/json.arrlen/ @@ -25,4 +25,9 @@ class JSONARRLEN extends RedisCommand { return 'JSON.ARRLEN'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/Json/JSONARRPOP.php b/vendor/predis/predis/src/Command/Redis/Json/JSONARRPOP.php index 080fa3b..6de9af2 100644 --- a/vendor/predis/predis/src/Command/Redis/Json/JSONARRPOP.php +++ b/vendor/predis/predis/src/Command/Redis/Json/JSONARRPOP.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\Json; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/json.arrpop/ @@ -25,4 +25,9 @@ class JSONARRPOP extends RedisCommand { return 'JSON.ARRPOP'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/Json/JSONARRTRIM.php b/vendor/predis/predis/src/Command/Redis/Json/JSONARRTRIM.php index 70af333..6aaa238 100644 --- a/vendor/predis/predis/src/Command/Redis/Json/JSONARRTRIM.php +++ b/vendor/predis/predis/src/Command/Redis/Json/JSONARRTRIM.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\Json; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/json.arrtrim/ @@ -25,4 +25,9 @@ class JSONARRTRIM extends RedisCommand { return 'JSON.ARRTRIM'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/Json/JSONCLEAR.php b/vendor/predis/predis/src/Command/Redis/Json/JSONCLEAR.php index af7b690..4842b16 100644 --- a/vendor/predis/predis/src/Command/Redis/Json/JSONCLEAR.php +++ b/vendor/predis/predis/src/Command/Redis/Json/JSONCLEAR.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\Json; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/json.clear/ @@ -25,4 +25,9 @@ class JSONCLEAR extends RedisCommand { return 'JSON.CLEAR'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/Json/JSONDEL.php b/vendor/predis/predis/src/Command/Redis/Json/JSONDEL.php index 8ee739c..b6bdb7d 100644 --- a/vendor/predis/predis/src/Command/Redis/Json/JSONDEL.php +++ b/vendor/predis/predis/src/Command/Redis/Json/JSONDEL.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\Json; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/json.del/ @@ -25,4 +25,9 @@ class JSONDEL extends RedisCommand { return 'JSON.DEL'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/Json/JSONFORGET.php b/vendor/predis/predis/src/Command/Redis/Json/JSONFORGET.php index 4abe251..01b7625 100644 --- a/vendor/predis/predis/src/Command/Redis/Json/JSONFORGET.php +++ b/vendor/predis/predis/src/Command/Redis/Json/JSONFORGET.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\Json; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/json.forget/ @@ -25,4 +25,9 @@ class JSONFORGET extends RedisCommand { return 'JSON.FORGET'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/Json/JSONGET.php b/vendor/predis/predis/src/Command/Redis/Json/JSONGET.php index 64aceba..3ccefa6 100644 --- a/vendor/predis/predis/src/Command/Redis/Json/JSONGET.php +++ b/vendor/predis/predis/src/Command/Redis/Json/JSONGET.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\Json; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; use Predis\Command\Traits\Json\Indent; use Predis\Command\Traits\Json\Newline; use Predis\Command\Traits\Json\Space; @@ -54,4 +54,9 @@ class JSONGET extends RedisCommand $this->setIndent($arguments); $this->filterArguments(); } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/Json/JSONMERGE.php b/vendor/predis/predis/src/Command/Redis/Json/JSONMERGE.php index f272c4b..b72fd59 100644 --- a/vendor/predis/predis/src/Command/Redis/Json/JSONMERGE.php +++ b/vendor/predis/predis/src/Command/Redis/Json/JSONMERGE.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\Json; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/json.merge/ @@ -26,4 +26,9 @@ class JSONMERGE extends RedisCommand { return 'JSON.MERGE'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/Json/JSONMGET.php b/vendor/predis/predis/src/Command/Redis/Json/JSONMGET.php index fa1f19a..aefa23a 100644 --- a/vendor/predis/predis/src/Command/Redis/Json/JSONMGET.php +++ b/vendor/predis/predis/src/Command/Redis/Json/JSONMGET.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\Json; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; class JSONMGET extends RedisCommand { @@ -33,4 +33,9 @@ class JSONMGET extends RedisCommand parent::setArguments($unpackedArguments); } + + public function prefixKeys($prefix) + { + $this->applyPrefixSkippingLastArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/Json/JSONMSET.php b/vendor/predis/predis/src/Command/Redis/Json/JSONMSET.php index 5b72c03..45c089d 100644 --- a/vendor/predis/predis/src/Command/Redis/Json/JSONMSET.php +++ b/vendor/predis/predis/src/Command/Redis/Json/JSONMSET.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\Json; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/json.mset/ @@ -25,4 +25,15 @@ class JSONMSET extends RedisCommand { return 'JSON.MSET'; } + + public function prefixKeys($prefix) + { + if ($arguments = $this->getArguments()) { + for ($i = 0, $l = count($arguments); $i < $l; $i += 3) { + $arguments[$i] = $prefix . $arguments[$i]; + } + + $this->setArguments($arguments); + } + } } diff --git a/vendor/predis/predis/src/Command/Redis/Json/JSONNUMINCRBY.php b/vendor/predis/predis/src/Command/Redis/Json/JSONNUMINCRBY.php index 6902500..9ca4610 100644 --- a/vendor/predis/predis/src/Command/Redis/Json/JSONNUMINCRBY.php +++ b/vendor/predis/predis/src/Command/Redis/Json/JSONNUMINCRBY.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\Json; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/json.numincrby/ @@ -25,4 +25,9 @@ class JSONNUMINCRBY extends RedisCommand { return 'JSON.NUMINCRBY'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/Json/JSONOBJKEYS.php b/vendor/predis/predis/src/Command/Redis/Json/JSONOBJKEYS.php index 74a3b99..9e6d011 100644 --- a/vendor/predis/predis/src/Command/Redis/Json/JSONOBJKEYS.php +++ b/vendor/predis/predis/src/Command/Redis/Json/JSONOBJKEYS.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\Json; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/json.objkeys/ @@ -25,4 +25,9 @@ class JSONOBJKEYS extends RedisCommand { return 'JSON.OBJKEYS'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/Json/JSONOBJLEN.php b/vendor/predis/predis/src/Command/Redis/Json/JSONOBJLEN.php index 352fc68..fc2327f 100644 --- a/vendor/predis/predis/src/Command/Redis/Json/JSONOBJLEN.php +++ b/vendor/predis/predis/src/Command/Redis/Json/JSONOBJLEN.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\Json; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/json.objlen/ @@ -25,4 +25,9 @@ class JSONOBJLEN extends RedisCommand { return 'JSON.OBJLEN'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/Json/JSONRESP.php b/vendor/predis/predis/src/Command/Redis/Json/JSONRESP.php index f771580..6088fba 100644 --- a/vendor/predis/predis/src/Command/Redis/Json/JSONRESP.php +++ b/vendor/predis/predis/src/Command/Redis/Json/JSONRESP.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\Json; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/json.resp/ @@ -25,4 +25,9 @@ class JSONRESP extends RedisCommand { return 'JSON.RESP'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/Json/JSONSET.php b/vendor/predis/predis/src/Command/Redis/Json/JSONSET.php index 43c683a..aec3a32 100644 --- a/vendor/predis/predis/src/Command/Redis/Json/JSONSET.php +++ b/vendor/predis/predis/src/Command/Redis/Json/JSONSET.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\Json; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; use Predis\Command\Traits\Json\NxXxArgument; /** @@ -38,4 +38,9 @@ class JSONSET extends RedisCommand $this->setSubcommand($arguments); $this->filterArguments(); } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/Json/JSONSTRAPPEND.php b/vendor/predis/predis/src/Command/Redis/Json/JSONSTRAPPEND.php index b717fc8..bb7aca3 100644 --- a/vendor/predis/predis/src/Command/Redis/Json/JSONSTRAPPEND.php +++ b/vendor/predis/predis/src/Command/Redis/Json/JSONSTRAPPEND.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\Json; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/json.strappend/ @@ -25,4 +25,9 @@ class JSONSTRAPPEND extends RedisCommand { return 'JSON.STRAPPEND'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/Json/JSONSTRLEN.php b/vendor/predis/predis/src/Command/Redis/Json/JSONSTRLEN.php index c11ff08..dbfe2e8 100644 --- a/vendor/predis/predis/src/Command/Redis/Json/JSONSTRLEN.php +++ b/vendor/predis/predis/src/Command/Redis/Json/JSONSTRLEN.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\Json; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/json.strlen/ @@ -25,4 +25,9 @@ class JSONSTRLEN extends RedisCommand { return 'JSON.STRLEN'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/Json/JSONTOGGLE.php b/vendor/predis/predis/src/Command/Redis/Json/JSONTOGGLE.php index b538c1c..74eda8e 100644 --- a/vendor/predis/predis/src/Command/Redis/Json/JSONTOGGLE.php +++ b/vendor/predis/predis/src/Command/Redis/Json/JSONTOGGLE.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\Json; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/json.toggle/ @@ -25,4 +25,9 @@ class JSONTOGGLE extends RedisCommand { return 'JSON.TOGGLE'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/Json/JSONTYPE.php b/vendor/predis/predis/src/Command/Redis/Json/JSONTYPE.php index 76123d4..f903e44 100644 --- a/vendor/predis/predis/src/Command/Redis/Json/JSONTYPE.php +++ b/vendor/predis/predis/src/Command/Redis/Json/JSONTYPE.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\Json; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/json.type/ @@ -25,4 +25,9 @@ class JSONTYPE extends RedisCommand { return 'JSON.TYPE'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/LMOVE.php b/vendor/predis/predis/src/Command/Redis/LMOVE.php index 95d906e..bd23249 100644 --- a/vendor/predis/predis/src/Command/Redis/LMOVE.php +++ b/vendor/predis/predis/src/Command/Redis/LMOVE.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; class LMOVE extends RedisCommand { @@ -20,4 +20,14 @@ class LMOVE extends RedisCommand { return 'LMOVE'; } + + public function prefixKeys($prefix) + { + if ($arguments = $this->getArguments()) { + $arguments[0] = $prefix . $arguments[0]; + $arguments[1] = $prefix . $arguments[1]; + + $this->setRawArguments($arguments); + } + } } diff --git a/vendor/predis/predis/src/Command/Redis/SMISMEMBER.php b/vendor/predis/predis/src/Command/Redis/SMISMEMBER.php index f34d05d..8fefa2d 100644 --- a/vendor/predis/predis/src/Command/Redis/SMISMEMBER.php +++ b/vendor/predis/predis/src/Command/Redis/SMISMEMBER.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/smismember/ @@ -25,4 +25,9 @@ class SMISMEMBER extends RedisCommand { return 'SMISMEMBER'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/Search/FTAGGREGATE.php b/vendor/predis/predis/src/Command/Redis/Search/FTAGGREGATE.php index f1c752a..58c4251 100644 --- a/vendor/predis/predis/src/Command/Redis/Search/FTAGGREGATE.php +++ b/vendor/predis/predis/src/Command/Redis/Search/FTAGGREGATE.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\Search; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/ft.aggregate/ @@ -50,4 +50,9 @@ class FTAGGREGATE extends RedisCommand $commandArguments )); } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/Search/FTALIASADD.php b/vendor/predis/predis/src/Command/Redis/Search/FTALIASADD.php index 12b1945..84e5f82 100644 --- a/vendor/predis/predis/src/Command/Redis/Search/FTALIASADD.php +++ b/vendor/predis/predis/src/Command/Redis/Search/FTALIASADD.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\Search; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/ft.aliasadd/ @@ -25,4 +25,9 @@ class FTALIASADD extends RedisCommand { return 'FT.ALIASADD'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForAllArguments($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/Search/FTALIASDEL.php b/vendor/predis/predis/src/Command/Redis/Search/FTALIASDEL.php index 1ef3224..fe2da39 100644 --- a/vendor/predis/predis/src/Command/Redis/Search/FTALIASDEL.php +++ b/vendor/predis/predis/src/Command/Redis/Search/FTALIASDEL.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\Search; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/ft.aliasdel/ @@ -25,4 +25,9 @@ class FTALIASDEL extends RedisCommand { return 'FT.ALIASDEL'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/Search/FTALIASUPDATE.php b/vendor/predis/predis/src/Command/Redis/Search/FTALIASUPDATE.php index 28d522b..0a89c8e 100644 --- a/vendor/predis/predis/src/Command/Redis/Search/FTALIASUPDATE.php +++ b/vendor/predis/predis/src/Command/Redis/Search/FTALIASUPDATE.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\Search; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/ft.aliasupdate/ @@ -26,4 +26,9 @@ class FTALIASUPDATE extends RedisCommand { return 'FT.ALIASUPDATE'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForAllArguments($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/Search/FTALTER.php b/vendor/predis/predis/src/Command/Redis/Search/FTALTER.php index a209af6..5d261cb 100644 --- a/vendor/predis/predis/src/Command/Redis/Search/FTALTER.php +++ b/vendor/predis/predis/src/Command/Redis/Search/FTALTER.php @@ -13,7 +13,7 @@ namespace Predis\Command\Redis\Search; use Predis\Command\Argument\Search\SchemaFields\FieldInterface; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; class FTALTER extends RedisCommand { @@ -39,4 +39,9 @@ class FTALTER extends RedisCommand $schema )); } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/Search/FTCREATE.php b/vendor/predis/predis/src/Command/Redis/Search/FTCREATE.php index 8d2a7ee..d716ab6 100644 --- a/vendor/predis/predis/src/Command/Redis/Search/FTCREATE.php +++ b/vendor/predis/predis/src/Command/Redis/Search/FTCREATE.php @@ -13,7 +13,7 @@ namespace Predis\Command\Redis\Search; use Predis\Command\Argument\Search\SchemaFields\FieldInterface; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/ft.create/ @@ -44,4 +44,9 @@ class FTCREATE extends RedisCommand $schema )); } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/Search/FTCURSOR.php b/vendor/predis/predis/src/Command/Redis/Search/FTCURSOR.php index 5794fa8..053fc9f 100644 --- a/vendor/predis/predis/src/Command/Redis/Search/FTCURSOR.php +++ b/vendor/predis/predis/src/Command/Redis/Search/FTCURSOR.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\Search; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; class FTCURSOR extends RedisCommand { @@ -31,4 +31,9 @@ class FTCURSOR extends RedisCommand $commandArguments )); } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/Search/FTDICTADD.php b/vendor/predis/predis/src/Command/Redis/Search/FTDICTADD.php index 2c48ea6..b2bfc71 100644 --- a/vendor/predis/predis/src/Command/Redis/Search/FTDICTADD.php +++ b/vendor/predis/predis/src/Command/Redis/Search/FTDICTADD.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\Search; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/ft.dictadd/ @@ -25,4 +25,9 @@ class FTDICTADD extends RedisCommand { return 'FT.DICTADD'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/Search/FTDICTDEL.php b/vendor/predis/predis/src/Command/Redis/Search/FTDICTDEL.php index a18cae3..ca6fed4 100644 --- a/vendor/predis/predis/src/Command/Redis/Search/FTDICTDEL.php +++ b/vendor/predis/predis/src/Command/Redis/Search/FTDICTDEL.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\Search; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/ft.dictdel/ @@ -25,4 +25,9 @@ class FTDICTDEL extends RedisCommand { return 'FT.DICTDEL'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/Search/FTDICTDUMP.php b/vendor/predis/predis/src/Command/Redis/Search/FTDICTDUMP.php index b8323cf..e8381c6 100644 --- a/vendor/predis/predis/src/Command/Redis/Search/FTDICTDUMP.php +++ b/vendor/predis/predis/src/Command/Redis/Search/FTDICTDUMP.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\Search; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/ft.dictdump/ @@ -25,4 +25,9 @@ class FTDICTDUMP extends RedisCommand { return 'FT.DICTDUMP'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/Search/FTDROPINDEX.php b/vendor/predis/predis/src/Command/Redis/Search/FTDROPINDEX.php index 6282bda..075823b 100644 --- a/vendor/predis/predis/src/Command/Redis/Search/FTDROPINDEX.php +++ b/vendor/predis/predis/src/Command/Redis/Search/FTDROPINDEX.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\Search; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; class FTDROPINDEX extends RedisCommand { @@ -35,4 +35,9 @@ class FTDROPINDEX extends RedisCommand $commandArguments )); } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/Search/FTEXPLAIN.php b/vendor/predis/predis/src/Command/Redis/Search/FTEXPLAIN.php index e2834cb..6802875 100644 --- a/vendor/predis/predis/src/Command/Redis/Search/FTEXPLAIN.php +++ b/vendor/predis/predis/src/Command/Redis/Search/FTEXPLAIN.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\Search; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/ft.explain/ @@ -49,4 +49,9 @@ class FTEXPLAIN extends RedisCommand $commandArguments )); } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/Search/FTINFO.php b/vendor/predis/predis/src/Command/Redis/Search/FTINFO.php index 26f6de6..a9df065 100644 --- a/vendor/predis/predis/src/Command/Redis/Search/FTINFO.php +++ b/vendor/predis/predis/src/Command/Redis/Search/FTINFO.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\Search; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/ft.info/ @@ -25,4 +25,9 @@ class FTINFO extends RedisCommand { return 'FT.INFO'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/Search/FTPROFILE.php b/vendor/predis/predis/src/Command/Redis/Search/FTPROFILE.php index e361807..0f2d29f 100644 --- a/vendor/predis/predis/src/Command/Redis/Search/FTPROFILE.php +++ b/vendor/predis/predis/src/Command/Redis/Search/FTPROFILE.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\Search; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/ft.profile/ @@ -35,4 +35,9 @@ class FTPROFILE extends RedisCommand $arguments->toArray() )); } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/Search/FTSEARCH.php b/vendor/predis/predis/src/Command/Redis/Search/FTSEARCH.php index 3e2cd13..992caa3 100644 --- a/vendor/predis/predis/src/Command/Redis/Search/FTSEARCH.php +++ b/vendor/predis/predis/src/Command/Redis/Search/FTSEARCH.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\Search; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/ft.search/ @@ -49,4 +49,9 @@ class FTSEARCH extends RedisCommand $commandArguments )); } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/Search/FTSPELLCHECK.php b/vendor/predis/predis/src/Command/Redis/Search/FTSPELLCHECK.php index 431c7b8..5c25049 100644 --- a/vendor/predis/predis/src/Command/Redis/Search/FTSPELLCHECK.php +++ b/vendor/predis/predis/src/Command/Redis/Search/FTSPELLCHECK.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\Search; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; class FTSPELLCHECK extends RedisCommand { @@ -48,4 +48,9 @@ class FTSPELLCHECK extends RedisCommand $commandArguments )); } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/Search/FTSYNDUMP.php b/vendor/predis/predis/src/Command/Redis/Search/FTSYNDUMP.php index 59ebafa..ed33ec1 100644 --- a/vendor/predis/predis/src/Command/Redis/Search/FTSYNDUMP.php +++ b/vendor/predis/predis/src/Command/Redis/Search/FTSYNDUMP.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\Search; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/ft.syndump/ @@ -25,4 +25,9 @@ class FTSYNDUMP extends RedisCommand { return 'FT.SYNDUMP'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/Search/FTSYNUPDATE.php b/vendor/predis/predis/src/Command/Redis/Search/FTSYNUPDATE.php index 4302e5d..e83cf9f 100644 --- a/vendor/predis/predis/src/Command/Redis/Search/FTSYNUPDATE.php +++ b/vendor/predis/predis/src/Command/Redis/Search/FTSYNUPDATE.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\Search; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/ft.synupdate/ @@ -43,4 +43,9 @@ class FTSYNUPDATE extends RedisCommand $terms )); } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/Search/FTTAGVALS.php b/vendor/predis/predis/src/Command/Redis/Search/FTTAGVALS.php index 0ec2c9d..c97ec56 100644 --- a/vendor/predis/predis/src/Command/Redis/Search/FTTAGVALS.php +++ b/vendor/predis/predis/src/Command/Redis/Search/FTTAGVALS.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\Search; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/ft.tagvals/ @@ -25,4 +25,9 @@ class FTTAGVALS extends RedisCommand { return 'FT.TAGVALS'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTADD.php b/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTADD.php index 5a060d9..6b0bb62 100644 --- a/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTADD.php +++ b/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTADD.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\TDigest; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/tdigest.add/ @@ -25,4 +25,9 @@ class TDIGESTADD extends RedisCommand { return 'TDIGEST.ADD'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTBYRANK.php b/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTBYRANK.php index 7e36602..2ca9730 100644 --- a/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTBYRANK.php +++ b/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTBYRANK.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\TDigest; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/tdigest.byrank/ @@ -52,4 +52,9 @@ class TDIGESTBYRANK extends RedisCommand } }, $data); } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTBYREVRANK.php b/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTBYREVRANK.php index e3eca0e..ebe9763 100644 --- a/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTBYREVRANK.php +++ b/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTBYREVRANK.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\TDigest; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/tdigest.byrevrank/ @@ -52,4 +52,9 @@ class TDIGESTBYREVRANK extends RedisCommand } }, $data); } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTCDF.php b/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTCDF.php index 9da737a..3cf22a5 100644 --- a/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTCDF.php +++ b/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTCDF.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\TDigest; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/tdigest.cdf/ @@ -54,4 +54,9 @@ class TDIGESTCDF extends RedisCommand } }, $data); } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTCREATE.php b/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTCREATE.php index d975ee3..0ecd181 100644 --- a/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTCREATE.php +++ b/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTCREATE.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\TDigest; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/tdigest.create/ @@ -37,4 +37,9 @@ class TDIGESTCREATE extends RedisCommand parent::setArguments($arguments); } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTINFO.php b/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTINFO.php index 93c9829..6888241 100644 --- a/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTINFO.php +++ b/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTINFO.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\TDigest; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/tdigest.info/ @@ -38,4 +38,9 @@ class TDIGESTINFO extends RedisCommand return $result; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTMAX.php b/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTMAX.php index f648845..cea35bd 100644 --- a/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTMAX.php +++ b/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTMAX.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\TDigest; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/tdigest.max/ @@ -46,4 +46,9 @@ class TDIGESTMAX extends RedisCommand default: return $data; } } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTMERGE.php b/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTMERGE.php index 5c60ac3..1baf1e9 100644 --- a/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTMERGE.php +++ b/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTMERGE.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\TDigest; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/tdigest.merge/ @@ -40,4 +40,17 @@ class TDIGESTMERGE extends RedisCommand parent::setArguments($processedArguments); } + + public function prefixKeys($prefix) + { + if ($arguments = $this->getArguments()) { + $arguments[0] = $prefix . $arguments[0]; + + for ($i = 2, $iMax = (int) $arguments[1] + 2; $i < $iMax; $i++) { + $arguments[$i] = $prefix . $arguments[$i]; + } + + $this->setRawArguments($arguments); + } + } } diff --git a/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTMIN.php b/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTMIN.php index 77f1d5f..d4d9b4b 100644 --- a/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTMIN.php +++ b/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTMIN.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\TDigest; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/tdigest.min/ @@ -46,4 +46,9 @@ class TDIGESTMIN extends RedisCommand default: return $data; } } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTQUANTILE.php b/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTQUANTILE.php index dae3c29..cd7683d 100644 --- a/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTQUANTILE.php +++ b/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTQUANTILE.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\TDigest; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/tdigest.quantile/ @@ -52,4 +52,9 @@ class TDIGESTQUANTILE extends RedisCommand } }, $data); } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTRANK.php b/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTRANK.php index e0c3255..016450f 100644 --- a/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTRANK.php +++ b/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTRANK.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\TDigest; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/tdigest.rank/ @@ -27,4 +27,9 @@ class TDIGESTRANK extends RedisCommand { return 'TDIGEST.RANK'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTRESET.php b/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTRESET.php index 20fb874..4a12911 100644 --- a/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTRESET.php +++ b/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTRESET.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\TDigest; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/tdigest.reset/ @@ -25,4 +25,9 @@ class TDIGESTRESET extends RedisCommand { return 'TDIGEST.RESET'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTREVRANK.php b/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTREVRANK.php index e6edbd8..926781d 100644 --- a/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTREVRANK.php +++ b/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTREVRANK.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\TDigest; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/tdigest.revrank/ @@ -27,4 +27,9 @@ class TDIGESTREVRANK extends RedisCommand { return 'TDIGEST.REVRANK'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTTRIMMED_MEAN.php b/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTTRIMMED_MEAN.php index 2490eef..793ad0c 100644 --- a/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTTRIMMED_MEAN.php +++ b/vendor/predis/predis/src/Command/Redis/TDigest/TDIGESTTRIMMED_MEAN.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\TDigest; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/tdigest.trimmed_mean/ @@ -47,4 +47,9 @@ class TDIGESTTRIMMED_MEAN extends RedisCommand default: return $data; } } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/TimeSeries/TSADD.php b/vendor/predis/predis/src/Command/Redis/TimeSeries/TSADD.php index 68707e5..9f2bb82 100644 --- a/vendor/predis/predis/src/Command/Redis/TimeSeries/TSADD.php +++ b/vendor/predis/predis/src/Command/Redis/TimeSeries/TSADD.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\TimeSeries; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/ts.add/ @@ -36,4 +36,9 @@ class TSADD extends RedisCommand $commandArguments )); } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/TimeSeries/TSALTER.php b/vendor/predis/predis/src/Command/Redis/TimeSeries/TSALTER.php index 9d46fe2..f2587bf 100644 --- a/vendor/predis/predis/src/Command/Redis/TimeSeries/TSALTER.php +++ b/vendor/predis/predis/src/Command/Redis/TimeSeries/TSALTER.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\TimeSeries; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/ts.alter/ @@ -36,4 +36,9 @@ class TSALTER extends RedisCommand $commandArguments )); } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/TimeSeries/TSCREATE.php b/vendor/predis/predis/src/Command/Redis/TimeSeries/TSCREATE.php index 29f815c..540d39d 100644 --- a/vendor/predis/predis/src/Command/Redis/TimeSeries/TSCREATE.php +++ b/vendor/predis/predis/src/Command/Redis/TimeSeries/TSCREATE.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\TimeSeries; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/ts.create/ @@ -36,4 +36,9 @@ class TSCREATE extends RedisCommand $commandArguments )); } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/TimeSeries/TSCREATERULE.php b/vendor/predis/predis/src/Command/Redis/TimeSeries/TSCREATERULE.php index 9e9adce..0005f01 100644 --- a/vendor/predis/predis/src/Command/Redis/TimeSeries/TSCREATERULE.php +++ b/vendor/predis/predis/src/Command/Redis/TimeSeries/TSCREATERULE.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\TimeSeries; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/ts.createrule/ @@ -37,4 +37,14 @@ class TSCREATERULE extends RedisCommand parent::setArguments($processedArguments); } + + public function prefixKeys($prefix) + { + if ($arguments = $this->getArguments()) { + $arguments[0] = $prefix . $arguments[0]; + $arguments[1] = $prefix . $arguments[1]; + + $this->setRawArguments($arguments); + } + } } diff --git a/vendor/predis/predis/src/Command/Redis/TimeSeries/TSDECRBY.php b/vendor/predis/predis/src/Command/Redis/TimeSeries/TSDECRBY.php index 5978794..d311788 100644 --- a/vendor/predis/predis/src/Command/Redis/TimeSeries/TSDECRBY.php +++ b/vendor/predis/predis/src/Command/Redis/TimeSeries/TSDECRBY.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\TimeSeries; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/ts.decrby/ @@ -38,4 +38,9 @@ class TSDECRBY extends RedisCommand $commandArguments )); } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/TimeSeries/TSDEL.php b/vendor/predis/predis/src/Command/Redis/TimeSeries/TSDEL.php index 83b9639..6e28d56 100644 --- a/vendor/predis/predis/src/Command/Redis/TimeSeries/TSDEL.php +++ b/vendor/predis/predis/src/Command/Redis/TimeSeries/TSDEL.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\TimeSeries; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/ts.del/ @@ -25,4 +25,9 @@ class TSDEL extends RedisCommand { return 'TS.DEL'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/TimeSeries/TSDELETERULE.php b/vendor/predis/predis/src/Command/Redis/TimeSeries/TSDELETERULE.php index c24643c..2552dcf 100644 --- a/vendor/predis/predis/src/Command/Redis/TimeSeries/TSDELETERULE.php +++ b/vendor/predis/predis/src/Command/Redis/TimeSeries/TSDELETERULE.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\TimeSeries; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/ts.deleterule/ @@ -25,4 +25,9 @@ class TSDELETERULE extends RedisCommand { return 'TS.DELETERULE'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/TimeSeries/TSGET.php b/vendor/predis/predis/src/Command/Redis/TimeSeries/TSGET.php index 13f8499..b3b11c1 100644 --- a/vendor/predis/predis/src/Command/Redis/TimeSeries/TSGET.php +++ b/vendor/predis/predis/src/Command/Redis/TimeSeries/TSGET.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\TimeSeries; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/ts.get/ @@ -36,4 +36,9 @@ class TSGET extends RedisCommand $commandArguments )); } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/TimeSeries/TSINCRBY.php b/vendor/predis/predis/src/Command/Redis/TimeSeries/TSINCRBY.php index e1bd0e0..df5b604 100644 --- a/vendor/predis/predis/src/Command/Redis/TimeSeries/TSINCRBY.php +++ b/vendor/predis/predis/src/Command/Redis/TimeSeries/TSINCRBY.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\TimeSeries; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/ts.incrby/ @@ -38,4 +38,9 @@ class TSINCRBY extends RedisCommand $commandArguments )); } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/TimeSeries/TSINFO.php b/vendor/predis/predis/src/Command/Redis/TimeSeries/TSINFO.php index 5ce146a..78ea149 100644 --- a/vendor/predis/predis/src/Command/Redis/TimeSeries/TSINFO.php +++ b/vendor/predis/predis/src/Command/Redis/TimeSeries/TSINFO.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\TimeSeries; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/ts.info/ @@ -36,4 +36,9 @@ class TSINFO extends RedisCommand $commandArguments )); } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/TimeSeries/TSMADD.php b/vendor/predis/predis/src/Command/Redis/TimeSeries/TSMADD.php index 02fc03e..e37d75c 100644 --- a/vendor/predis/predis/src/Command/Redis/TimeSeries/TSMADD.php +++ b/vendor/predis/predis/src/Command/Redis/TimeSeries/TSMADD.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\TimeSeries; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/ts.madd/ @@ -25,4 +25,15 @@ class TSMADD extends RedisCommand { return 'TS.MADD'; } + + public function prefixKeys($prefix) + { + if ($arguments = $this->getArguments()) { + for ($i = 0, $l = count($arguments); $i < $l; $i += 3) { + $arguments[$i] = $prefix . $arguments[$i]; + } + + $this->setArguments($arguments); + } + } } diff --git a/vendor/predis/predis/src/Command/Redis/TimeSeries/TSRANGE.php b/vendor/predis/predis/src/Command/Redis/TimeSeries/TSRANGE.php index 253ba4a..1a6b0bb 100644 --- a/vendor/predis/predis/src/Command/Redis/TimeSeries/TSRANGE.php +++ b/vendor/predis/predis/src/Command/Redis/TimeSeries/TSRANGE.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\TimeSeries; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/ts.range/ @@ -36,4 +36,9 @@ class TSRANGE extends RedisCommand $commandArguments )); } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/TopK/TOPKADD.php b/vendor/predis/predis/src/Command/Redis/TopK/TOPKADD.php index 990faaf..0beb77b 100644 --- a/vendor/predis/predis/src/Command/Redis/TopK/TOPKADD.php +++ b/vendor/predis/predis/src/Command/Redis/TopK/TOPKADD.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\TopK; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/topk.add/ @@ -28,4 +28,9 @@ class TOPKADD extends RedisCommand { return 'TOPK.ADD'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/TopK/TOPKINCRBY.php b/vendor/predis/predis/src/Command/Redis/TopK/TOPKINCRBY.php index c7fb9a6..2e7146a 100644 --- a/vendor/predis/predis/src/Command/Redis/TopK/TOPKINCRBY.php +++ b/vendor/predis/predis/src/Command/Redis/TopK/TOPKINCRBY.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\TopK; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/topk.incrby/ @@ -27,4 +27,9 @@ class TOPKINCRBY extends RedisCommand { return 'TOPK.INCRBY'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/TopK/TOPKINFO.php b/vendor/predis/predis/src/Command/Redis/TopK/TOPKINFO.php index 50a8ffa..292c806 100644 --- a/vendor/predis/predis/src/Command/Redis/TopK/TOPKINFO.php +++ b/vendor/predis/predis/src/Command/Redis/TopK/TOPKINFO.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\TopK; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/topk.info/ @@ -38,4 +38,9 @@ class TOPKINFO extends RedisCommand return $result; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/TopK/TOPKLIST.php b/vendor/predis/predis/src/Command/Redis/TopK/TOPKLIST.php index 6f9e9ac..a085300 100644 --- a/vendor/predis/predis/src/Command/Redis/TopK/TOPKLIST.php +++ b/vendor/predis/predis/src/Command/Redis/TopK/TOPKLIST.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\TopK; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/topk.list/ @@ -74,4 +74,9 @@ class TOPKLIST extends RedisCommand return is_string($lastArgument) && strtoupper($lastArgument) === 'WITHCOUNT'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/TopK/TOPKQUERY.php b/vendor/predis/predis/src/Command/Redis/TopK/TOPKQUERY.php index 5854935..9f6b7e5 100644 --- a/vendor/predis/predis/src/Command/Redis/TopK/TOPKQUERY.php +++ b/vendor/predis/predis/src/Command/Redis/TopK/TOPKQUERY.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\TopK; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/topk.query/ @@ -26,4 +26,9 @@ class TOPKQUERY extends RedisCommand { return 'TOPK.QUERY'; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/TopK/TOPKRESERVE.php b/vendor/predis/predis/src/Command/Redis/TopK/TOPKRESERVE.php index 1441548..ffe5768 100644 --- a/vendor/predis/predis/src/Command/Redis/TopK/TOPKRESERVE.php +++ b/vendor/predis/predis/src/Command/Redis/TopK/TOPKRESERVE.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis\TopK; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see https://redis.io/commands/topk.reserve/ @@ -44,4 +44,9 @@ class TOPKRESERVE extends RedisCommand parent::setArguments($arguments); } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/Utils/CommandUtility.php b/vendor/predis/predis/src/Command/Redis/Utils/CommandUtility.php new file mode 100644 index 0000000..4425f8e --- /dev/null +++ b/vendor/predis/predis/src/Command/Redis/Utils/CommandUtility.php @@ -0,0 +1,56 @@ + value + * @param bool $recursive + * @return array + */ + public static function arrayToDictionary(array $array, ?callable $callback = null, bool $recursive = true): array + { + if (count($array) % 2 !== 0) { + throw new UnexpectedValueException('Array must have an even number of arguments'); + } + + $dict = []; + + for ($i = 0; $i < count($array); $i += 2) { + if (is_array($array[$i + 1])) { + if ($recursive) { + $dict[$array[$i]] = self::arrayToDictionary($array[$i + 1], $callback, $recursive); + } else { + $dict[$array[$i]] = $array[$i + 1]; + } + } else { + if ($callback) { + [$key, $value] = $callback($array[$i], $array[$i + 1]); + } else { + $key = $array[$i]; + $value = $array[$i + 1]; + } + + $dict[$key] = $value; + } + } + + return $dict; + } +} diff --git a/vendor/predis/predis/src/Command/Redis/Utils/VectorUtility.php b/vendor/predis/predis/src/Command/Redis/Utils/VectorUtility.php new file mode 100644 index 0000000..7a320eb --- /dev/null +++ b/vendor/predis/predis/src/Command/Redis/Utils/VectorUtility.php @@ -0,0 +1,40 @@ +isRaw = true; + $processedArguments[] = 'RAW'; + } + + parent::setArguments($processedArguments); + } + + /** + * @param $data + * @return array|float[]|string|null + */ + public function parseResponse($data) + { + if (!$this->isRaw) { + return array_map(function ($value) { return (float) $value; }, $data); + } + + $parsedData = []; + + for ($i = 0; $i < count($data); $i++) { + if ($i > 1) { + $parsedData[] = (float) $data[$i]; + } else { + $parsedData[] = $data[$i]; + } + } + + return $parsedData; + } +} diff --git a/vendor/predis/predis/src/Command/Redis/VGETATTR.php b/vendor/predis/predis/src/Command/Redis/VGETATTR.php new file mode 100644 index 0000000..f2b4822 --- /dev/null +++ b/vendor/predis/predis/src/Command/Redis/VGETATTR.php @@ -0,0 +1,70 @@ +asJson = $lastArg; + } else { + $arguments[] = $lastArg; + } + + parent::setArguments($arguments); + } + + /** + * @param $data + * @return array|mixed|string|null + */ + public function parseResponse($data) + { + if (!$this->asJson && !is_null($data)) { + return json_decode($data, true); + } + + return $data; + } + + /** + * @param $data + * @return array|mixed|string|null + */ + public function parseResp3Response($data) + { + return $this->parseResponse($data); + } +} diff --git a/vendor/predis/predis/src/Command/Redis/VINFO.php b/vendor/predis/predis/src/Command/Redis/VINFO.php new file mode 100644 index 0000000..6faceb3 --- /dev/null +++ b/vendor/predis/predis/src/Command/Redis/VINFO.php @@ -0,0 +1,40 @@ +withScores = $lastArg; + $arguments[] = 'WITHSCORES'; + } else { + $arguments[] = $lastArg; + } + + parent::setArguments($arguments); + } + + /** + * @param $data + * @return array|null + */ + public function parseResponse($data): ?array + { + if (!is_null($data)) { + if ($this->withScores) { + foreach ($data as $key => $value) { + $data[$key] = CommandUtility::arrayToDictionary($value, function ($key, $value) { + return [$key, (float) $value]; + }); + } + } + } + + return $data; + } +} diff --git a/vendor/predis/predis/src/Command/Redis/VRANDMEMBER.php b/vendor/predis/predis/src/Command/Redis/VRANDMEMBER.php new file mode 100644 index 0000000..77d1187 --- /dev/null +++ b/vendor/predis/predis/src/Command/Redis/VRANDMEMBER.php @@ -0,0 +1,41 @@ +withScores = true; + $processedArguments[] = 'WITHSCORES'; + } + + if (isset($arguments[4])) { + array_push($processedArguments, 'COUNT', $arguments[4]); + } + + if (isset($arguments[5])) { + array_push($processedArguments, 'EPSILON', $arguments[5]); + } + + if (isset($arguments[6])) { + array_push($processedArguments, 'EF', $arguments[6]); + } + + if (isset($arguments[7])) { + array_push($processedArguments, 'FILTER', $arguments[7]); + } + + if (isset($arguments[8])) { + array_push($processedArguments, 'FILTER-EF', $arguments[8]); + } + + if (isset($arguments[9]) && false !== $arguments[9]) { + $processedArguments[] = 'TRUTH'; + } + + if (isset($arguments[10]) && false !== $arguments[10]) { + $processedArguments[] = 'NOTHREAD'; + } + + parent::setArguments($processedArguments); + } + + /** + * @param $data + * @return array|mixed|string|null + */ + public function parseResponse($data) + { + if ($this->withScores) { + $data = CommandUtility::arrayToDictionary($data, function ($key, $value) { + return [$key, (float) $value]; + }); + } + + return $data; + } +} diff --git a/vendor/predis/predis/src/Command/Redis/XACK.php b/vendor/predis/predis/src/Command/Redis/XACK.php new file mode 100644 index 0000000..545e01f --- /dev/null +++ b/vendor/predis/predis/src/Command/Redis/XACK.php @@ -0,0 +1,34 @@ +applyPrefixForFirstArgument($prefix); + } +} diff --git a/vendor/predis/predis/src/Command/Redis/XACKDEL.php b/vendor/predis/predis/src/Command/Redis/XACKDEL.php new file mode 100644 index 0000000..464038a --- /dev/null +++ b/vendor/predis/predis/src/Command/Redis/XACKDEL.php @@ -0,0 +1,46 @@ +applyPrefixForFirstArgument($prefix); + } +} diff --git a/vendor/predis/predis/src/Command/Redis/XADD.php b/vendor/predis/predis/src/Command/Redis/XADD.php index be35ad7..49d4f5e 100644 --- a/vendor/predis/predis/src/Command/Redis/XADD.php +++ b/vendor/predis/predis/src/Command/Redis/XADD.php @@ -50,8 +50,13 @@ class XADD extends RedisCommand } } + if (isset($options['trimming'])) { + $args[] = strtoupper($options['trimming']); + } + // ID, default to * to let Redis set it $args[] = $arguments[2] ?? '*'; + if (isset($arguments[1]) && is_array($arguments[1])) { foreach ($arguments[1] as $key => $val) { $args[] = $key; diff --git a/vendor/predis/predis/src/Command/Redis/XCLAIM.php b/vendor/predis/predis/src/Command/Redis/XCLAIM.php new file mode 100644 index 0000000..d31b900 --- /dev/null +++ b/vendor/predis/predis/src/Command/Redis/XCLAIM.php @@ -0,0 +1,89 @@ +parseResponse($data); + } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } +} diff --git a/vendor/predis/predis/src/Command/Redis/XDELEX.php b/vendor/predis/predis/src/Command/Redis/XDELEX.php new file mode 100644 index 0000000..f375186 --- /dev/null +++ b/vendor/predis/predis/src/Command/Redis/XDELEX.php @@ -0,0 +1,46 @@ +applyPrefixForFirstArgument($prefix); + } +} diff --git a/vendor/predis/predis/src/Command/Redis/XINFO.php b/vendor/predis/predis/src/Command/Redis/XINFO.php index 4d00e67..0749574 100644 --- a/vendor/predis/predis/src/Command/Redis/XINFO.php +++ b/vendor/predis/predis/src/Command/Redis/XINFO.php @@ -14,6 +14,7 @@ namespace Predis\Command\Redis; use Predis\Command\Argument\ArrayableArgument; use Predis\Command\Command as RedisCommand; +use Predis\Command\Redis\Utils\CommandUtility; class XINFO extends RedisCommand { @@ -47,17 +48,61 @@ class XINFO extends RedisCommand } public function parseResponse($data) + { + if ($this->getArgument(0) === 'STREAM') { + return $this->parseStreamResponse($data); + } + + return $this->parseDict($data); + } + + private function parseStreamResponse($data): array + { + $result = CommandUtility::arrayToDictionary($data, null, false); + + if (isset($result['entries'])) { + $result['entries'] = $this->parseDict($result['entries']); + } + + if (isset($result['groups']) && is_array($result['groups'])) { + $result['groups'] = array_map(static function ($group) { + $group = CommandUtility::arrayToDictionary($group, null, false); + if (isset($group['consumers'])) { + $group['consumers'] = array_map(static function ($consumer) { + return CommandUtility::arrayToDictionary($consumer, null, false); + }, $group['consumers']); + } + + return $group; + }, $result['groups']); + } + + return $result; + } + + public function parseResp3Response($data) + { + $result = $data; + if (isset($result['entries'])) { + $result['entries'] = $this->parseDict($result['entries']); + } + + return $result; + } + + private function parseDict($data): array { $result = []; for ($i = 0, $iMax = count($data); $i < $iMax; $i++) { if (is_array($data[$i])) { - $result[$i] = $this->parseResponse($data[$i]); + $result[$i] = $this->parseDict($data[$i]); + continue; } if (array_key_exists($i + 1, $data)) { if (is_array($data[$i + 1])) { - $result[$data[$i]] = $this->parseResponse($data[++$i]); + $result[$data[$i]] = $this->parseDict($data[++$i]); } else { $result[$data[$i]] = $data[++$i]; } diff --git a/vendor/predis/predis/src/Command/Redis/XPENDING.php b/vendor/predis/predis/src/Command/Redis/XPENDING.php new file mode 100644 index 0000000..1dda862 --- /dev/null +++ b/vendor/predis/predis/src/Command/Redis/XPENDING.php @@ -0,0 +1,81 @@ +getArgument(2) !== null) { + return $data; + } + + [$pending, $minId, $maxId, $consumers] = $data; + if (is_array($consumers)) { + $parsedConsumers = []; + foreach ($consumers as [$consumer, $num]) { + $parsedConsumers[$consumer] = (int) $num; + } + } else { + $parsedConsumers = $consumers; + } + + return [$pending, $minId, $maxId, $parsedConsumers]; + } + + public function parseResp3Response($data): array + { + return $this->parseResponse($data); + } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } +} diff --git a/vendor/predis/predis/src/Command/Redis/XREAD.php b/vendor/predis/predis/src/Command/Redis/XREAD.php index 523050b..6b76fc2 100644 --- a/vendor/predis/predis/src/Command/Redis/XREAD.php +++ b/vendor/predis/predis/src/Command/Redis/XREAD.php @@ -46,6 +46,10 @@ class XREAD extends RedisCommand public function parseResponse($data) { + if (!$data) { + return []; + } + $processedData = []; foreach ($data as $stream) { diff --git a/vendor/predis/predis/src/Command/Redis/XSETID.php b/vendor/predis/predis/src/Command/Redis/XSETID.php new file mode 100644 index 0000000..1818582 --- /dev/null +++ b/vendor/predis/predis/src/Command/Redis/XSETID.php @@ -0,0 +1,49 @@ +applyPrefixForFirstArgument($prefix); + } +} diff --git a/vendor/predis/predis/src/Command/Redis/XTRIM.php b/vendor/predis/predis/src/Command/Redis/XTRIM.php index c12a89d..b481c8f 100644 --- a/vendor/predis/predis/src/Command/Redis/XTRIM.php +++ b/vendor/predis/predis/src/Command/Redis/XTRIM.php @@ -49,6 +49,10 @@ class XTRIM extends RedisCommand $args[] = $options['limit']; } + if (isset($options['trimming'])) { + $args[] = strtoupper($options['trimming']); + } + parent::setArguments($args); } diff --git a/vendor/predis/predis/src/Command/Redis/ZPOPMAX.php b/vendor/predis/predis/src/Command/Redis/ZPOPMAX.php index 95b41c6..351debb 100644 --- a/vendor/predis/predis/src/Command/Redis/ZPOPMAX.php +++ b/vendor/predis/predis/src/Command/Redis/ZPOPMAX.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see http://redis.io/commands/zpopmax @@ -63,4 +63,9 @@ class ZPOPMAX extends RedisCommand return $parsedData; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Command/Redis/ZPOPMIN.php b/vendor/predis/predis/src/Command/Redis/ZPOPMIN.php index 80a5047..de43d22 100644 --- a/vendor/predis/predis/src/Command/Redis/ZPOPMIN.php +++ b/vendor/predis/predis/src/Command/Redis/ZPOPMIN.php @@ -12,7 +12,7 @@ namespace Predis\Command\Redis; -use Predis\Command\Command as RedisCommand; +use Predis\Command\PrefixableCommand as RedisCommand; /** * @see http://redis.io/commands/zpopmin @@ -63,4 +63,9 @@ class ZPOPMIN extends RedisCommand return $parsedData; } + + public function prefixKeys($prefix) + { + $this->applyPrefixForFirstArgument($prefix); + } } diff --git a/vendor/predis/predis/src/Connection/Replication/SentinelReplication.php b/vendor/predis/predis/src/Connection/Replication/SentinelReplication.php index 38867e2..1d0310f 100644 --- a/vendor/predis/predis/src/Connection/Replication/SentinelReplication.php +++ b/vendor/predis/predis/src/Connection/Replication/SentinelReplication.php @@ -16,7 +16,6 @@ use InvalidArgumentException; use Predis\Command\Command; use Predis\Command\CommandInterface; use Predis\Command\RawCommand; -use Predis\CommunicationException; use Predis\Connection\AbstractAggregateConnection; use Predis\Connection\ConnectionException; use Predis\Connection\FactoryInterface as ConnectionFactoryInterface; @@ -28,6 +27,7 @@ use Predis\Replication\RoleException; use Predis\Response\Error; use Predis\Response\ErrorInterface as ErrorResponseInterface; use Predis\Response\ServerException; +use Throwable; /** * @author Daniele Alessandri @@ -715,10 +715,16 @@ class SentinelReplication extends AbstractAggregateConnection implements Replica while ($retries <= $this->retryLimit) { try { $response = $this->getConnectionByCommand($command)->$method($command); + if ($response instanceof Error && $response->getErrorType() === 'LOADING') { + throw new ConnectionException($this->current, $response->getMessage()); + } break; - } catch (CommunicationException $exception) { + } catch (Throwable $exception) { $this->wipeServerList(); - $exception->getConnection()->disconnect(); + + if ($exception instanceof ConnectionException) { + $exception->getConnection()->disconnect(); + } if ($retries === $this->retryLimit) { throw $exception; diff --git a/vendor/predis/predis/src/Connection/Resource/Stream.php b/vendor/predis/predis/src/Connection/Resource/Stream.php index 0e20227..271a160 100644 --- a/vendor/predis/predis/src/Connection/Resource/Stream.php +++ b/vendor/predis/predis/src/Connection/Resource/Stream.php @@ -276,6 +276,7 @@ class Stream implements StreamInterface /** * {@inheritDoc} + * @return mixed */ public function getMetadata(?string $key = null) { diff --git a/vendor/predis/predis/src/Connection/Resource/StreamFactory.php b/vendor/predis/predis/src/Connection/Resource/StreamFactory.php index a459e1a..4298cd6 100644 --- a/vendor/predis/predis/src/Connection/Resource/StreamFactory.php +++ b/vendor/predis/predis/src/Connection/Resource/StreamFactory.php @@ -168,7 +168,11 @@ class StreamFactory implements StreamFactoryInterface $options['crypto_type'] = STREAM_CRYPTO_METHOD_TLS_CLIENT; } - if (!stream_context_set_option($resource, ['ssl' => $options])) { + $context_options = function_exists('stream_context_set_options') + ? stream_context_set_options($resource, ['ssl' => $options]) + : stream_context_set_option($resource, ['ssl' => $options]); + + if (!$context_options) { $this->onInitializationError($resource, $parameters, 'Error while setting SSL context options'); } diff --git a/vendor/predis/predis/src/Connection/StreamConnection.php b/vendor/predis/predis/src/Connection/StreamConnection.php index bfcdbdc..667dede 100644 --- a/vendor/predis/predis/src/Connection/StreamConnection.php +++ b/vendor/predis/predis/src/Connection/StreamConnection.php @@ -59,8 +59,6 @@ class StreamConnection extends AbstractConnection public function __construct(ParametersInterface $parameters, ?StreamFactoryInterface $factory = null) { parent::__construct($parameters); - $this->parameters->conn_uid = spl_object_hash($this); - $this->streamFactory = $factory ?? new StreamFactory(); } @@ -145,7 +143,7 @@ class StreamConnection extends AbstractConnection $stream = $this->getResource(); if ($stream->eof()) { - $this->onStreamError(new RuntimeException('Stream is already at the end'), ''); + $this->onStreamError(new RuntimeException('', 1), 'Stream is already at the end'); } try { diff --git a/vendor/ramsey/uuid/composer.json b/vendor/ramsey/uuid/composer.json index db44292..b34d9b1 100644 --- a/vendor/ramsey/uuid/composer.json +++ b/vendor/ramsey/uuid/composer.json @@ -10,7 +10,7 @@ ], "require": { "php": "^8.0", - "brick/math": "^0.8.8 || ^0.9 || ^0.10 || ^0.11 || ^0.12 || ^0.13", + "brick/math": "^0.8.8 || ^0.9 || ^0.10 || ^0.11 || ^0.12 || ^0.13 || ^0.14", "ramsey/collection": "^1.2 || ^2.0" }, "require-dev": { diff --git a/vendor/ramsey/uuid/src/Generator/UnixTimeGenerator.php b/vendor/ramsey/uuid/src/Generator/UnixTimeGenerator.php index 024ed51..a2615f1 100644 --- a/vendor/ramsey/uuid/src/Generator/UnixTimeGenerator.php +++ b/vendor/ramsey/uuid/src/Generator/UnixTimeGenerator.php @@ -15,7 +15,6 @@ declare(strict_types=1); namespace Ramsey\Uuid\Generator; use Brick\Math\BigInteger; -use DateTimeImmutable; use DateTimeInterface; use Ramsey\Uuid\Type\Hexadecimal; @@ -68,7 +67,12 @@ class UnixTimeGenerator implements TimeGeneratorInterface */ public function generate($node = null, ?int $clockSeq = null, ?DateTimeInterface $dateTime = null): string { - $time = ($dateTime ?? new DateTimeImmutable('now'))->format('Uv'); + if ($dateTime === null) { + $time = microtime(false); + $time = substr($time, 11) . substr($time, 2, 3); + } else { + $time = $dateTime->format('Uv'); + } if ($time > self::$time || ($dateTime !== null && $time !== self::$time)) { $this->randomize($time); diff --git a/vendor/ramsey/uuid/src/Math/BrickMathCalculator.php b/vendor/ramsey/uuid/src/Math/BrickMathCalculator.php index 869835e..649f580 100644 --- a/vendor/ramsey/uuid/src/Math/BrickMathCalculator.php +++ b/vendor/ramsey/uuid/src/Math/BrickMathCalculator.php @@ -49,10 +49,10 @@ final class BrickMathCalculator implements CalculatorInterface $sum = BigInteger::of($augend->toString()); foreach ($addends as $addend) { - $sum = $sum->plus($addend->toString()); /** @phpstan-ignore possiblyImpure.methodCall */ + $sum = $sum->plus($addend->toString()); } - /** @phpstan-ignore possiblyImpure.methodCall, possiblyImpure.new */ + /** @phpstan-ignore possiblyImpure.new */ return new IntegerObject((string) $sum); } @@ -61,10 +61,10 @@ final class BrickMathCalculator implements CalculatorInterface $difference = BigInteger::of($minuend->toString()); foreach ($subtrahends as $subtrahend) { - $difference = $difference->minus($subtrahend->toString()); /** @phpstan-ignore possiblyImpure.methodCall */ + $difference = $difference->minus($subtrahend->toString()); } - /** @phpstan-ignore possiblyImpure.methodCall, possiblyImpure.new */ + /** @phpstan-ignore possiblyImpure.new */ return new IntegerObject((string) $difference); } @@ -73,11 +73,10 @@ final class BrickMathCalculator implements CalculatorInterface $product = BigInteger::of($multiplicand->toString()); foreach ($multipliers as $multiplier) { - /** @phpstan-ignore possiblyImpure.methodCall */ $product = $product->multipliedBy($multiplier->toString()); } - /** @phpstan-ignore possiblyImpure.methodCall, possiblyImpure.new */ + /** @phpstan-ignore possiblyImpure.new */ return new IntegerObject((string) $product); } @@ -93,23 +92,22 @@ final class BrickMathCalculator implements CalculatorInterface $quotient = BigDecimal::of($dividend->toString()); foreach ($divisors as $divisor) { - /** @phpstan-ignore possiblyImpure.methodCall */ $quotient = $quotient->dividedBy($divisor->toString(), $scale, $brickRounding); } if ($scale === 0) { - /** @phpstan-ignore possiblyImpure.methodCall, possiblyImpure.methodCall, possiblyImpure.new */ + /** @phpstan-ignore possiblyImpure.new */ return new IntegerObject((string) $quotient->toBigInteger()); } - /** @phpstan-ignore possiblyImpure.methodCall, possiblyImpure.new */ + /** @phpstan-ignore possiblyImpure.new */ return new Decimal((string) $quotient); } public function fromBase(string $value, int $base): IntegerObject { try { - /** @phpstan-ignore possiblyImpure.methodCall, possiblyImpure.new */ + /** @phpstan-ignore possiblyImpure.new */ return new IntegerObject((string) BigInteger::fromBase($value, $base)); } catch (MathException | \InvalidArgumentException $exception) { throw new InvalidArgumentException( @@ -123,7 +121,6 @@ final class BrickMathCalculator implements CalculatorInterface public function toBase(IntegerObject $value, int $base): string { try { - /** @phpstan-ignore possiblyImpure.methodCall */ return BigInteger::of($value->toString())->toBase($base); } catch (MathException | \InvalidArgumentException $exception) { throw new InvalidArgumentException( diff --git a/vendor/tedivm/jshrink/src/JShrink/Minifier.php b/vendor/tedivm/jshrink/src/JShrink/Minifier.php index f0a078d..1582d0f 100644 --- a/vendor/tedivm/jshrink/src/JShrink/Minifier.php +++ b/vendor/tedivm/jshrink/src/JShrink/Minifier.php @@ -628,11 +628,25 @@ class Minifier } $this->echo($this->b); + // Flag to make sure that we don't end the regex too early because of + // unescaped forward slashes inside a character class. e.g /[/]/ + // In non-v-mode, The only characters that cannot appear literally are \, ], and - + // In v-mode more characters are reserved and forbidden from appearing literally + // including but not limited to [ ] \ / + $character_class = false; + $character_class_index = null; while (($this->a = $this->getChar()) !== false) { - if ($this->a === '/') { + if ($this->a === '/' && !$character_class) { break; } + + if ($this->a === '[') { + $character_class = true; + $character_class_index = $this->index; + } elseif ($this->a === ']') { + $character_class = false; + } if ($this->a === '\\') { $this->echo($this->a); @@ -640,6 +654,9 @@ class Minifier } if ($this->a === "\n") { + if ($character_class) { + throw new \RuntimeException('Unclosed character class at position: ' . $character_class_index); + } throw new \RuntimeException('Unclosed regex pattern at position: ' . $this->index); }