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, 16 insertions, 9 deletions
diff --git a/vendor/ramsey/uuid/src/Type/Integer.php b/vendor/ramsey/uuid/src/Type/Integer.php index e41b3cad5..7690f6cd8 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 str_starts_with; +use function strpos; use function substr; /** @@ -40,17 +40,23 @@ final class Integer implements NumberInterface /** * @psalm-var numeric-string */ - private string $value; + private $value; - private bool $isNegative = false; + /** + * @var bool + */ + private $isNegative = false; - public function __construct(float | int | string | self $value) + /** + * @param mixed $value The integer value to store + */ + public function __construct($value) { $value = (string) $value; $sign = '+'; // If the value contains a sign, remove it for ctype_digit() check. - if (str_starts_with($value, '-') || str_starts_with($value, '+')) { + if (strpos($value, '-') === 0 || strpos($value, '+') === 0) { $sign = substr($value, 0, 1); $value = substr($value, 1); } @@ -121,17 +127,18 @@ final class Integer implements NumberInterface /** * Constructs the object from a serialized string representation * - * @param string $data The serialized string representation of the object + * @param string $serialized The serialized string representation of the object * + * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint * @psalm-suppress UnusedMethodCall */ - public function unserialize(string $data): void + public function unserialize($serialized): void { - $this->__construct($data); + $this->__construct($serialized); } /** - * @param array{string?: string} $data + * @param array{string: string} $data */ public function __unserialize(array $data): void { |