diff options
Diffstat (limited to 'vendor/ramsey/uuid/src/Type/Integer.php')
-rw-r--r-- | vendor/ramsey/uuid/src/Type/Integer.php | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/vendor/ramsey/uuid/src/Type/Integer.php b/vendor/ramsey/uuid/src/Type/Integer.php index 7690f6cd8..e41b3cad5 100644 --- a/vendor/ramsey/uuid/src/Type/Integer.php +++ b/vendor/ramsey/uuid/src/Type/Integer.php @@ -20,7 +20,7 @@ use ValueError; use function ctype_digit; use function ltrim; use function sprintf; -use function strpos; +use function str_starts_with; use function substr; /** @@ -40,23 +40,17 @@ final class Integer implements NumberInterface /** * @psalm-var numeric-string */ - private $value; + private string $value; - /** - * @var bool - */ - private $isNegative = false; + private bool $isNegative = false; - /** - * @param mixed $value The integer value to store - */ - public function __construct($value) + public function __construct(float | int | string | self $value) { $value = (string) $value; $sign = '+'; // If the value contains a sign, remove it for ctype_digit() check. - if (strpos($value, '-') === 0 || strpos($value, '+') === 0) { + if (str_starts_with($value, '-') || str_starts_with($value, '+')) { $sign = substr($value, 0, 1); $value = substr($value, 1); } @@ -127,18 +121,17 @@ final class Integer 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 */ public function __unserialize(array $data): void { |