aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/brick/math/src/BigInteger.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/brick/math/src/BigInteger.php')
-rw-r--r--vendor/brick/math/src/BigInteger.php33
1 files changed, 33 insertions, 0 deletions
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