diff options
author | Mario <mario@mariovavti.com> | 2021-10-08 12:24:19 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2021-10-08 12:24:19 +0000 |
commit | e6dac085cb1d601da1fc63bfd59d811612fa6ef4 (patch) | |
tree | f5b704b613c9c8d347857b4e7f8dd0b19cdd7df3 /vendor/ramsey/uuid/src/Type/Integer.php | |
parent | f5f357060bf0ebcb0b8352519375953d993437e7 (diff) | |
download | volse-hubzilla-e6dac085cb1d601da1fc63bfd59d811612fa6ef4.tar.gz volse-hubzilla-e6dac085cb1d601da1fc63bfd59d811612fa6ef4.tar.bz2 volse-hubzilla-e6dac085cb1d601da1fc63bfd59d811612fa6ef4.zip |
update composer libs
Diffstat (limited to 'vendor/ramsey/uuid/src/Type/Integer.php')
-rw-r--r-- | vendor/ramsey/uuid/src/Type/Integer.php | 35 |
1 files changed, 33 insertions, 2 deletions
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']); + } } |