From e6dac085cb1d601da1fc63bfd59d811612fa6ef4 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 8 Oct 2021 12:24:19 +0000 Subject: update composer libs --- vendor/brick/math/src/BigDecimal.php | 36 +++++++++++++++++++++- vendor/brick/math/src/BigInteger.php | 33 ++++++++++++++++++++ vendor/brick/math/src/BigRational.php | 34 ++++++++++++++++++++ vendor/brick/math/src/Internal/Calculator.php | 5 +-- .../src/Internal/Calculator/NativeCalculator.php | 2 +- 5 files changed, 104 insertions(+), 6 deletions(-) (limited to 'vendor/brick/math/src') diff --git a/vendor/brick/math/src/BigDecimal.php b/vendor/brick/math/src/BigDecimal.php index 7707b166e..78246500c 100644 --- a/vendor/brick/math/src/BigDecimal.php +++ b/vendor/brick/math/src/BigDecimal.php @@ -752,6 +752,40 @@ final class BigDecimal extends BigNumber return \substr($value, 0, -$this->scale) . '.' . \substr($value, -$this->scale); } + /** + * This method is required for serializing the object and SHOULD NOT be accessed directly. + * + * @internal + * + * @return array{value: string, scale: int} + */ + public function __serialize(): array + { + return ['value' => $this->value, 'scale' => $this->scale]; + } + + /** + * 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 + * + * @return void + * + * @throws \LogicException + */ + public function __unserialize(array $data): void + { + if (isset($this->value)) { + throw new \LogicException('__unserialize() is an internal function, it must not be called directly.'); + } + + $this->value = $data['value']; + $this->scale = $data['scale']; + } + /** * This method is required by interface Serializable and SHOULD NOT be accessed directly. * @@ -794,7 +828,7 @@ final class BigDecimal extends BigNumber * @param BigDecimal $x The first decimal number. * @param BigDecimal $y The second decimal number. * - * @return array{0: string, 1: string} The scaled integer values of $x and $y. + * @return array{string, string} The scaled integer values of $x and $y. */ private function scaleValues(BigDecimal $x, BigDecimal $y) : array { diff --git a/vendor/brick/math/src/BigInteger.php b/vendor/brick/math/src/BigInteger.php index 0dcc8f3b3..f213fbedb 100644 --- a/vendor/brick/math/src/BigInteger.php +++ b/vendor/brick/math/src/BigInteger.php @@ -1116,6 +1116,39 @@ final class BigInteger extends BigNumber return $this->value; } + /** + * This method is required for serializing the object and SHOULD NOT be accessed directly. + * + * @internal + * + * @return array{value: string} + */ + public function __serialize(): array + { + return ['value' => $this->value]; + } + + /** + * This method is only here to allow unserializing the object and cannot be accessed directly. + * + * @internal + * @psalm-suppress RedundantPropertyInitializationCheck + * + * @param array{value: string} $data + * + * @return void + * + * @throws \LogicException + */ + public function __unserialize(array $data): void + { + if (isset($this->value)) { + throw new \LogicException('__unserialize() is an internal function, it must not be called directly.'); + } + + $this->value = $data['value']; + } + /** * This method is required by interface Serializable and SHOULD NOT be accessed directly. * diff --git a/vendor/brick/math/src/BigRational.php b/vendor/brick/math/src/BigRational.php index 7fbabd7f1..bee094f73 100644 --- a/vendor/brick/math/src/BigRational.php +++ b/vendor/brick/math/src/BigRational.php @@ -451,6 +451,40 @@ final class BigRational extends BigNumber return $this->numerator . '/' . $this->denominator; } + /** + * This method is required for serializing the object and SHOULD NOT be accessed directly. + * + * @internal + * + * @return array{numerator: BigInteger, denominator: BigInteger} + */ + public function __serialize(): array + { + return ['numerator' => $this->numerator, 'denominator' => $this->denominator]; + } + + /** + * 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 + * + * @return void + * + * @throws \LogicException + */ + public function __unserialize(array $data): void + { + if (isset($this->numerator)) { + throw new \LogicException('__unserialize() is an internal function, it must not be called directly.'); + } + + $this->numerator = $data['numerator']; + $this->denominator = $data['denominator']; + } + /** * This method is required by interface Serializable and SHOULD NOT be accessed directly. * diff --git a/vendor/brick/math/src/Internal/Calculator.php b/vendor/brick/math/src/Internal/Calculator.php index 99b478193..a6eac799f 100644 --- a/vendor/brick/math/src/Internal/Calculator.php +++ b/vendor/brick/math/src/Internal/Calculator.php @@ -99,7 +99,7 @@ abstract class Calculator * @param string $a The first operand. * @param string $b The second operand. * - * @return array{0: bool, 1: bool, 2: string, 3: string} Whether $a and $b are negative, followed by their digits. + * @return array{bool, bool, string, string} Whether $a and $b are negative, followed by their digits. */ final protected function init(string $a, string $b) : array { @@ -677,9 +677,6 @@ abstract class Calculator } /** - * @psalm-suppress InvalidOperand - * @see https://github.com/vimeo/psalm/issues/4456 - * * @param string $number A positive, binary number. * * @return string diff --git a/vendor/brick/math/src/Internal/Calculator/NativeCalculator.php b/vendor/brick/math/src/Internal/Calculator/NativeCalculator.php index a5f8a9b48..020a6338b 100644 --- a/vendor/brick/math/src/Internal/Calculator/NativeCalculator.php +++ b/vendor/brick/math/src/Internal/Calculator/NativeCalculator.php @@ -610,7 +610,7 @@ class NativeCalculator extends Calculator * @param string $a The first operand. * @param string $b The second operand. * - * @return array{0: string, 1: string, 2: int} + * @return array{string, string, int} */ private function pad(string $a, string $b) : array { -- cgit v1.2.3