diff options
author | mjfriaza <mjfriaza@disroot.org> | 2022-05-17 13:44:06 +0200 |
---|---|---|
committer | mjfriaza <mjfriaza@disroot.org> | 2022-05-17 13:44:06 +0200 |
commit | a75c61d71efebf43713026200aa0f513bd7eef09 (patch) | |
tree | 909048adeaa329813e2530d43626ed3bd711bc25 /vendor/brick/math/src/BigRational.php | |
parent | 481ecee9e87342ca7a1217395085e95d1a3b61ea (diff) | |
parent | 0d0f73fb67bbfcc53058cefded85ac36f951c7a7 (diff) | |
download | volse-hubzilla-a75c61d71efebf43713026200aa0f513bd7eef09.tar.gz volse-hubzilla-a75c61d71efebf43713026200aa0f513bd7eef09.tar.bz2 volse-hubzilla-a75c61d71efebf43713026200aa0f513bd7eef09.zip |
Merge remote-tracking branch 'upstream/dev' into dev
Diffstat (limited to 'vendor/brick/math/src/BigRational.php')
-rw-r--r-- | vendor/brick/math/src/BigRational.php | 34 |
1 files changed, 34 insertions, 0 deletions
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 |