From e6dac085cb1d601da1fc63bfd59d811612fa6ef4 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 8 Oct 2021 12:24:19 +0000 Subject: update composer libs --- .../uuid/src/Fields/SerializableFieldsTrait.php | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'vendor/ramsey/uuid/src/Fields') diff --git a/vendor/ramsey/uuid/src/Fields/SerializableFieldsTrait.php b/vendor/ramsey/uuid/src/Fields/SerializableFieldsTrait.php index 4ae90be2c..16e6525da 100644 --- a/vendor/ramsey/uuid/src/Fields/SerializableFieldsTrait.php +++ b/vendor/ramsey/uuid/src/Fields/SerializableFieldsTrait.php @@ -14,7 +14,10 @@ declare(strict_types=1); namespace Ramsey\Uuid\Fields; +use ValueError; + use function base64_decode; +use function sprintf; use function strlen; /** @@ -42,12 +45,21 @@ trait SerializableFieldsTrait return $this->getBytes(); } + /** + * @return array{bytes: string} + */ + public function __serialize(): array + { + return ['bytes' => $this->getBytes()]; + } + /** * Constructs the object from a serialized string representation * * @param string $serialized The serialized string representation of the object * * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint + * @psalm-suppress UnusedMethodCall */ public function unserialize($serialized): void { @@ -57,4 +69,18 @@ trait SerializableFieldsTrait $this->__construct(base64_decode($serialized)); } } + + /** + * @param array{bytes: string} $data + */ + public function __unserialize(array $data): void + { + // @codeCoverageIgnoreStart + if (!isset($data['bytes'])) { + throw new ValueError(sprintf('%s(): Argument #1 ($data) is invalid', __METHOD__)); + } + // @codeCoverageIgnoreEnd + + $this->unserialize($data['bytes']); + } } -- cgit v1.2.3