aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/brick/math/src
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/brick/math/src')
-rw-r--r--vendor/brick/math/src/BigDecimal.php36
-rw-r--r--vendor/brick/math/src/BigInteger.php33
-rw-r--r--vendor/brick/math/src/BigRational.php34
-rw-r--r--vendor/brick/math/src/Internal/Calculator.php5
-rw-r--r--vendor/brick/math/src/Internal/Calculator/NativeCalculator.php2
5 files changed, 104 insertions, 6 deletions
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
@@ -753,6 +753,40 @@ final class BigDecimal extends BigNumber
}
/**
+ * 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.
*
* @internal
@@ -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
@@ -1117,6 +1117,39 @@ final class BigInteger extends BigNumber
}
/**
+ * 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.
*
* @internal
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
@@ -452,6 +452,40 @@ final class BigRational extends BigNumber
}
/**
+ * 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.
*
* @internal
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
{