aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/ramsey/uuid/src/Type
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2021-10-08 12:24:19 +0000
committerMario <mario@mariovavti.com>2021-10-08 12:24:19 +0000
commite6dac085cb1d601da1fc63bfd59d811612fa6ef4 (patch)
treef5b704b613c9c8d347857b4e7f8dd0b19cdd7df3 /vendor/ramsey/uuid/src/Type
parentf5f357060bf0ebcb0b8352519375953d993437e7 (diff)
downloadvolse-hubzilla-e6dac085cb1d601da1fc63bfd59d811612fa6ef4.tar.gz
volse-hubzilla-e6dac085cb1d601da1fc63bfd59d811612fa6ef4.tar.bz2
volse-hubzilla-e6dac085cb1d601da1fc63bfd59d811612fa6ef4.zip
update composer libs
Diffstat (limited to 'vendor/ramsey/uuid/src/Type')
-rw-r--r--vendor/ramsey/uuid/src/Type/Decimal.php25
-rw-r--r--vendor/ramsey/uuid/src/Type/Hexadecimal.php25
-rw-r--r--vendor/ramsey/uuid/src/Type/Integer.php35
-rw-r--r--vendor/ramsey/uuid/src/Type/Time.php28
4 files changed, 111 insertions, 2 deletions
diff --git a/vendor/ramsey/uuid/src/Type/Decimal.php b/vendor/ramsey/uuid/src/Type/Decimal.php
index 5ba886535..10f93845b 100644
--- a/vendor/ramsey/uuid/src/Type/Decimal.php
+++ b/vendor/ramsey/uuid/src/Type/Decimal.php
@@ -15,8 +15,10 @@ declare(strict_types=1);
namespace Ramsey\Uuid\Type;
use Ramsey\Uuid\Exception\InvalidArgumentException;
+use ValueError;
use function is_numeric;
+use function sprintf;
/**
* A value object representing a decimal
@@ -99,14 +101,37 @@ final class Decimal implements NumberInterface
}
/**
+ * @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']);
+ }
}
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']);
+ }
}
diff --git a/vendor/ramsey/uuid/src/Type/Integer.php b/vendor/ramsey/uuid/src/Type/Integer.php
index 05d420a85..7690f6cd8 100644
--- a/vendor/ramsey/uuid/src/Type/Integer.php
+++ b/vendor/ramsey/uuid/src/Type/Integer.php
@@ -15,9 +15,11 @@ declare(strict_types=1);
namespace Ramsey\Uuid\Type;
use Ramsey\Uuid\Exception\InvalidArgumentException;
+use ValueError;
use function ctype_digit;
use function ltrim;
+use function sprintf;
use function strpos;
use function substr;
@@ -36,7 +38,7 @@ use function substr;
final class Integer implements NumberInterface
{
/**
- * @var string
+ * @psalm-var numeric-string
*/
private $value;
@@ -80,7 +82,10 @@ final class Integer implements NumberInterface
$this->isNegative = true;
}
- $this->value = $value;
+ /** @psalm-var numeric-string $numericValue */
+ $numericValue = $value;
+
+ $this->value = $numericValue;
}
public function isNegative(): bool
@@ -88,6 +93,9 @@ final class Integer implements NumberInterface
return $this->isNegative;
}
+ /**
+ * @psalm-return numeric-string
+ */
public function toString(): string
{
return $this->value;
@@ -109,14 +117,37 @@ final class Integer implements NumberInterface
}
/**
+ * @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']);
+ }
}
diff --git a/vendor/ramsey/uuid/src/Type/Time.php b/vendor/ramsey/uuid/src/Type/Time.php
index f6a140f05..dd1b8bc28 100644
--- a/vendor/ramsey/uuid/src/Type/Time.php
+++ b/vendor/ramsey/uuid/src/Type/Time.php
@@ -16,10 +16,12 @@ namespace Ramsey\Uuid\Type;
use Ramsey\Uuid\Exception\UnsupportedOperationException;
use Ramsey\Uuid\Type\Integer as IntegerObject;
+use ValueError;
use stdClass;
use function json_decode;
use function json_encode;
+use function sprintf;
/**
* A value object representing a timestamp
@@ -89,11 +91,23 @@ final class Time implements TypeInterface
}
/**
+ * @return array{seconds: string, microseconds: string}
+ */
+ public function __serialize(): array
+ {
+ return [
+ 'seconds' => $this->getSeconds()->toString(),
+ 'microseconds' => $this->getMicroseconds()->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
{
@@ -108,4 +122,18 @@ final class Time implements TypeInterface
$this->__construct($time->seconds, $time->microseconds);
}
+
+ /**
+ * @param array{seconds: string, microseconds: string} $data
+ */
+ public function __unserialize(array $data): void
+ {
+ // @codeCoverageIgnoreStart
+ if (!isset($data['seconds']) || !isset($data['microseconds'])) {
+ throw new ValueError(sprintf('%s(): Argument #1 ($data) is invalid', __METHOD__));
+ }
+ // @codeCoverageIgnoreEnd
+
+ $this->__construct($data['seconds'], $data['microseconds']);
+ }
}