diff options
author | Mario <mario@mariovavti.com> | 2022-10-12 08:45:01 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2022-10-12 08:45:01 +0000 |
commit | 8bf5c18425cf15327fa11494e6e0d3749f36c6f8 (patch) | |
tree | fc358336312cd23030321a43f276db19cea17621 /vendor/ramsey/uuid/src/Type/Decimal.php | |
parent | c36bb17475b3dd5925cefc32752f1fb8a63df154 (diff) | |
download | volse-hubzilla-8bf5c18425cf15327fa11494e6e0d3749f36c6f8.tar.gz volse-hubzilla-8bf5c18425cf15327fa11494e6e0d3749f36c6f8.tar.bz2 volse-hubzilla-8bf5c18425cf15327fa11494e6e0d3749f36c6f8.zip |
composer update ramsey/uuid
Diffstat (limited to 'vendor/ramsey/uuid/src/Type/Decimal.php')
-rw-r--r-- | vendor/ramsey/uuid/src/Type/Decimal.php | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/vendor/ramsey/uuid/src/Type/Decimal.php b/vendor/ramsey/uuid/src/Type/Decimal.php index 10f93845b..acc5e754b 100644 --- a/vendor/ramsey/uuid/src/Type/Decimal.php +++ b/vendor/ramsey/uuid/src/Type/Decimal.php @@ -19,6 +19,7 @@ use ValueError; use function is_numeric; use function sprintf; +use function str_starts_with; /** * A value object representing a decimal @@ -34,20 +35,10 @@ use function sprintf; */ final class Decimal implements NumberInterface { - /** - * @var string - */ - private $value; - - /** - * @var bool - */ - private $isNegative = false; + private string $value; + private bool $isNegative = false; - /** - * @param mixed $value The decimal value to store - */ - public function __construct($value) + public function __construct(float | int | string | self $value) { $value = (string) $value; @@ -59,7 +50,7 @@ final class Decimal implements NumberInterface } // Remove the leading +-symbol. - if (strpos($value, '+') === 0) { + if (str_starts_with($value, '+')) { $value = substr($value, 1); } @@ -68,7 +59,7 @@ final class Decimal implements NumberInterface $value = '0'; } - if (strpos($value, '-') === 0) { + if (str_starts_with($value, '-')) { $this->isNegative = true; } @@ -111,18 +102,19 @@ final class Decimal implements NumberInterface /** * Constructs the object from a serialized string representation * - * @param string $serialized The serialized string representation of the object + * @param string $data The serialized string representation of the object * - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint * @psalm-suppress UnusedMethodCall */ - public function unserialize($serialized): void + public function unserialize(string $data): void { - $this->__construct($serialized); + $this->__construct($data); } /** - * @param array{string: string} $data + * @param array{string?: string} $data + * + * @psalm-suppress UnusedMethodCall */ public function __unserialize(array $data): void { |