aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/ramsey/uuid/src/Fields/SerializableFieldsTrait.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2021-11-09 09:10:19 +0000
committerMario <mario@mariovavti.com>2021-11-09 09:10:19 +0000
commitfe7ecede700fe04631d23f36473e697ce2b364dc (patch)
treee713fc39dba500a25cb2acf8561e286fb8b41ff0 /vendor/ramsey/uuid/src/Fields/SerializableFieldsTrait.php
parent42de18d96d201d74e5df3ed1b8f6132cb00357b6 (diff)
parent089708ab9f90309a0c27ae633cf8f2604fce1170 (diff)
downloadvolse-hubzilla-fe7ecede700fe04631d23f36473e697ce2b364dc.tar.gz
volse-hubzilla-fe7ecede700fe04631d23f36473e697ce2b364dc.tar.bz2
volse-hubzilla-fe7ecede700fe04631d23f36473e697ce2b364dc.zip
Merge branch '6.4RC'6.4
Diffstat (limited to 'vendor/ramsey/uuid/src/Fields/SerializableFieldsTrait.php')
-rw-r--r--vendor/ramsey/uuid/src/Fields/SerializableFieldsTrait.php26
1 files changed, 26 insertions, 0 deletions
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;
/**
@@ -43,11 +46,20 @@ trait SerializableFieldsTrait
}
/**
+ * @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']);
+ }
}