aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/ramsey/uuid/src/Type/Hexadecimal.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/ramsey/uuid/src/Type/Hexadecimal.php')
-rw-r--r--vendor/ramsey/uuid/src/Type/Hexadecimal.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/vendor/ramsey/uuid/src/Type/Hexadecimal.php b/vendor/ramsey/uuid/src/Type/Hexadecimal.php
index 11450186e..88adc2e7e 100644
--- a/vendor/ramsey/uuid/src/Type/Hexadecimal.php
+++ b/vendor/ramsey/uuid/src/Type/Hexadecimal.php
@@ -15,8 +15,10 @@ declare(strict_types=1);
namespace Ramsey\Uuid\Type;
use Ramsey\Uuid\Exception\InvalidArgumentException;
+use ValueError;
use function ctype_xdigit;
+use function sprintf;
use function strpos;
use function strtolower;
use function substr;
@@ -78,14 +80,37 @@ final class Hexadecimal implements TypeInterface
}
/**
+ * @return array{string: string}
+ */
+ public function __serialize(): array
+ {
+ return ['string' => $this->toString()];
+ }
+
+ /**
* 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
{
$this->__construct($serialized);
}
+
+ /**
+ * @param array{string: string} $data
+ */
+ public function __unserialize(array $data): void
+ {
+ // @codeCoverageIgnoreStart
+ if (!isset($data['string'])) {
+ throw new ValueError(sprintf('%s(): Argument #1 ($data) is invalid', __METHOD__));
+ }
+ // @codeCoverageIgnoreEnd
+
+ $this->unserialize($data['string']);
+ }
}