diff options
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 { |