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/ramsey/uuid/src/Uuid.php | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) (limited to 'vendor/ramsey/uuid/src/Uuid.php') diff --git a/vendor/ramsey/uuid/src/Uuid.php b/vendor/ramsey/uuid/src/Uuid.php index 762dfdbae..945480ba4 100644 --- a/vendor/ramsey/uuid/src/Uuid.php +++ b/vendor/ramsey/uuid/src/Uuid.php @@ -23,9 +23,12 @@ use Ramsey\Uuid\Lazy\LazyUuidFromString; use Ramsey\Uuid\Rfc4122\FieldsInterface as Rfc4122FieldsInterface; use Ramsey\Uuid\Type\Hexadecimal; use Ramsey\Uuid\Type\Integer as IntegerObject; +use ValueError; +use function assert; use function bin2hex; use function preg_match; +use function sprintf; use function str_replace; use function strcmp; use function strlen; @@ -238,9 +241,9 @@ class Uuid implements UuidInterface * ``` * use Ramsey\Uuid\Uuid; * - * $timeBasedUuid = Uuid::uuid1(); - * $namespaceMd5Uuid = Uuid::uuid3(Uuid::NAMESPACE_URL, 'http://php.net/'); - * $randomUuid = Uuid::uuid4(); + * $timeBasedUuid = Uuid::uuid1(); + * $namespaceMd5Uuid = Uuid::uuid3(Uuid::NAMESPACE_URL, 'http://php.net/'); + * $randomUuid = Uuid::uuid4(); * $namespaceSha1Uuid = Uuid::uuid5(Uuid::NAMESPACE_URL, 'http://php.net/'); * ``` * @@ -285,7 +288,15 @@ class Uuid implements UuidInterface */ public function serialize(): string { - return $this->getBytes(); + return $this->getFields()->getBytes(); + } + + /** + * @return array{bytes: string} + */ + public function __serialize(): array + { + return ['bytes' => $this->serialize()]; } /** @@ -312,6 +323,20 @@ class Uuid implements UuidInterface $this->timeConverter = $uuid->timeConverter; } + /** + * @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']); + } + public function compareTo(UuidInterface $other): int { $compare = strcmp($this->toString(), $other->toString()); @@ -452,6 +477,8 @@ class Uuid implements UuidInterface public static function fromString(string $uuid): UuidInterface { if (! self::$factoryReplaced && preg_match(LazyUuidFromString::VALID_REGEX, $uuid) === 1) { + assert($uuid !== ''); + return new LazyUuidFromString(strtolower($uuid)); } -- cgit v1.2.3