aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/ramsey/uuid/src/Type
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/ramsey/uuid/src/Type')
-rw-r--r--vendor/ramsey/uuid/src/Type/Decimal.php32
-rw-r--r--vendor/ramsey/uuid/src/Type/Hexadecimal.php18
-rw-r--r--vendor/ramsey/uuid/src/Type/Integer.php25
-rw-r--r--vendor/ramsey/uuid/src/Type/Time.php37
4 files changed, 71 insertions, 41 deletions
diff --git a/vendor/ramsey/uuid/src/Type/Decimal.php b/vendor/ramsey/uuid/src/Type/Decimal.php
index acc5e754b..10f93845b 100644
--- a/vendor/ramsey/uuid/src/Type/Decimal.php
+++ b/vendor/ramsey/uuid/src/Type/Decimal.php
@@ -19,7 +19,6 @@ use ValueError;
use function is_numeric;
use function sprintf;
-use function str_starts_with;
/**
* A value object representing a decimal
@@ -35,10 +34,20 @@ use function str_starts_with;
*/
final class Decimal implements NumberInterface
{
- private string $value;
- private bool $isNegative = false;
+ /**
+ * @var string
+ */
+ private $value;
+
+ /**
+ * @var bool
+ */
+ private $isNegative = false;
- public function __construct(float | int | string | self $value)
+ /**
+ * @param mixed $value The decimal value to store
+ */
+ public function __construct($value)
{
$value = (string) $value;
@@ -50,7 +59,7 @@ final class Decimal implements NumberInterface
}
// Remove the leading +-symbol.
- if (str_starts_with($value, '+')) {
+ if (strpos($value, '+') === 0) {
$value = substr($value, 1);
}
@@ -59,7 +68,7 @@ final class Decimal implements NumberInterface
$value = '0';
}
- if (str_starts_with($value, '-')) {
+ if (strpos($value, '-') === 0) {
$this->isNegative = true;
}
@@ -102,19 +111,18 @@ final class Decimal 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
- *
- * @psalm-suppress UnusedMethodCall
+ * @param array{string: string} $data
*/
public function __unserialize(array $data): void
{
diff --git a/vendor/ramsey/uuid/src/Type/Hexadecimal.php b/vendor/ramsey/uuid/src/Type/Hexadecimal.php
index 3c8f30adf..88adc2e7e 100644
--- a/vendor/ramsey/uuid/src/Type/Hexadecimal.php
+++ b/vendor/ramsey/uuid/src/Type/Hexadecimal.php
@@ -19,7 +19,7 @@ use ValueError;
use function ctype_xdigit;
use function sprintf;
-use function str_starts_with;
+use function strpos;
use function strtolower;
use function substr;
@@ -34,7 +34,10 @@ use function substr;
*/
final class Hexadecimal implements TypeInterface
{
- private string $value;
+ /**
+ * @var string
+ */
+ private $value;
/**
* @param string $value The hexadecimal value to store
@@ -43,7 +46,7 @@ final class Hexadecimal implements TypeInterface
{
$value = strtolower($value);
- if (str_starts_with($value, '0x')) {
+ if (strpos($value, '0x') === 0) {
$value = substr($value, 2);
}
@@ -87,17 +90,18 @@ final class Hexadecimal implements TypeInterface
/**
* 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
{
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
{
diff --git a/vendor/ramsey/uuid/src/Type/Time.php b/vendor/ramsey/uuid/src/Type/Time.php
index 745b5ccab..dd1b8bc28 100644
--- a/vendor/ramsey/uuid/src/Type/Time.php
+++ b/vendor/ramsey/uuid/src/Type/Time.php
@@ -17,6 +17,7 @@ namespace Ramsey\Uuid\Type;
use Ramsey\Uuid\Exception\UnsupportedOperationException;
use Ramsey\Uuid\Type\Integer as IntegerObject;
use ValueError;
+use stdClass;
use function json_decode;
use function json_encode;
@@ -33,13 +34,22 @@ use function sprintf;
*/
final class Time implements TypeInterface
{
- private IntegerObject $seconds;
- private IntegerObject $microseconds;
+ /**
+ * @var IntegerObject
+ */
+ private $seconds;
+
+ /**
+ * @var IntegerObject
+ */
+ private $microseconds;
- public function __construct(
- float | int | string | IntegerObject $seconds,
- float | int | string | IntegerObject $microseconds = 0,
- ) {
+ /**
+ * @param mixed $seconds
+ * @param mixed $microseconds
+ */
+ public function __construct($seconds, $microseconds = 0)
+ {
$this->seconds = new IntegerObject($seconds);
$this->microseconds = new IntegerObject($microseconds);
}
@@ -94,26 +104,27 @@ final class Time implements TypeInterface
/**
* 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
{
- /** @var array{seconds?: int|float|string, microseconds?: int|float|string} $time */
- $time = json_decode($data, true);
+ /** @var stdClass $time */
+ $time = json_decode($serialized);
- if (!isset($time['seconds']) || !isset($time['microseconds'])) {
+ if (!isset($time->seconds) || !isset($time->microseconds)) {
throw new UnsupportedOperationException(
'Attempted to unserialize an invalid value'
);
}
- $this->__construct($time['seconds'], $time['microseconds']);
+ $this->__construct($time->seconds, $time->microseconds);
}
/**
- * @param array{seconds?: string, microseconds?: string} $data
+ * @param array{seconds: string, microseconds: string} $data
*/
public function __unserialize(array $data): void
{