🔧
This commit is contained in:
6
vendor/symfony/uid/AbstractUid.php
vendored
6
vendor/symfony/uid/AbstractUid.php
vendored
@@ -70,6 +70,8 @@ abstract class AbstractUid implements \JsonSerializable, \Stringable
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $uid A valid RFC 9562/4122 uid
|
||||
*
|
||||
* @throws \InvalidArgumentException When the passed value is not valid
|
||||
*/
|
||||
public static function fromRfc4122(string $uid): static
|
||||
@@ -120,9 +122,9 @@ abstract class AbstractUid implements \JsonSerializable, \Stringable
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the identifier as a RFC4122 case insensitive string.
|
||||
* Returns the identifier as a RFC 9562/4122 case insensitive string.
|
||||
*
|
||||
* @see https://tools.ietf.org/html/rfc4122#section-3
|
||||
* @see https://datatracker.ietf.org/doc/html/rfc9562/#section-4
|
||||
*
|
||||
* @example 09748193-048a-4bfb-b825-8528cf74fdc1 (len=36)
|
||||
*/
|
||||
|
||||
2
vendor/symfony/uid/BinaryUtil.php
vendored
2
vendor/symfony/uid/BinaryUtil.php
vendored
@@ -36,7 +36,7 @@ class BinaryUtil
|
||||
'u' => 52, 'v' => 53, 'w' => 54, 'x' => 55, 'y' => 56, 'z' => 57,
|
||||
];
|
||||
|
||||
// https://tools.ietf.org/html/rfc4122#section-4.1.4
|
||||
// https://datatracker.ietf.org/doc/html/rfc9562#section-5.1
|
||||
// 0x01b21dd213814000 is the number of 100-ns intervals between the
|
||||
// UUID epoch 1582-10-15 00:00:00 and the Unix epoch 1970-01-01 00:00:00.
|
||||
private const TIME_OFFSET_INT = 0x01B21DD213814000;
|
||||
|
||||
@@ -27,7 +27,7 @@ class GenerateUlidCommand extends Command
|
||||
{
|
||||
private UlidFactory $factory;
|
||||
|
||||
public function __construct(UlidFactory $factory = null)
|
||||
public function __construct(?UlidFactory $factory = null)
|
||||
{
|
||||
$this->factory = $factory ?? new UlidFactory();
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ class GenerateUuidCommand extends Command
|
||||
{
|
||||
private UuidFactory $factory;
|
||||
|
||||
public function __construct(UuidFactory $factory = null)
|
||||
public function __construct(?UuidFactory $factory = null)
|
||||
{
|
||||
$this->factory = $factory ?? new UuidFactory();
|
||||
|
||||
|
||||
@@ -25,13 +25,13 @@ class TimeBasedUuidFactory
|
||||
/**
|
||||
* @param class-string<Uuid&TimeBasedUidInterface> $class
|
||||
*/
|
||||
public function __construct(string $class, Uuid $node = null)
|
||||
public function __construct(string $class, ?Uuid $node = null)
|
||||
{
|
||||
$this->class = $class;
|
||||
$this->node = $node;
|
||||
}
|
||||
|
||||
public function create(\DateTimeInterface $time = null): Uuid&TimeBasedUidInterface
|
||||
public function create(?\DateTimeInterface $time = null): Uuid&TimeBasedUidInterface
|
||||
{
|
||||
$class = $this->class;
|
||||
|
||||
|
||||
2
vendor/symfony/uid/Factory/UlidFactory.php
vendored
2
vendor/symfony/uid/Factory/UlidFactory.php
vendored
@@ -15,7 +15,7 @@ use Symfony\Component\Uid\Ulid;
|
||||
|
||||
class UlidFactory
|
||||
{
|
||||
public function create(\DateTimeInterface $time = null): Ulid
|
||||
public function create(?\DateTimeInterface $time = null): Ulid
|
||||
{
|
||||
return new Ulid(null === $time ? null : Ulid::generate($time));
|
||||
}
|
||||
|
||||
6
vendor/symfony/uid/Factory/UuidFactory.php
vendored
6
vendor/symfony/uid/Factory/UuidFactory.php
vendored
@@ -26,7 +26,7 @@ class UuidFactory
|
||||
private ?Uuid $timeBasedNode;
|
||||
private ?Uuid $nameBasedNamespace;
|
||||
|
||||
public function __construct(string|int $defaultClass = UuidV6::class, string|int $timeBasedClass = UuidV6::class, string|int $nameBasedClass = UuidV5::class, string|int $randomBasedClass = UuidV4::class, Uuid|string $timeBasedNode = null, Uuid|string $nameBasedNamespace = null)
|
||||
public function __construct(string|int $defaultClass = UuidV6::class, string|int $timeBasedClass = UuidV6::class, string|int $nameBasedClass = UuidV5::class, string|int $randomBasedClass = UuidV4::class, Uuid|string|null $timeBasedNode = null, Uuid|string|null $nameBasedNamespace = null)
|
||||
{
|
||||
if (null !== $timeBasedNode && !$timeBasedNode instanceof Uuid) {
|
||||
$timeBasedNode = Uuid::fromString($timeBasedNode);
|
||||
@@ -56,7 +56,7 @@ class UuidFactory
|
||||
return new RandomBasedUuidFactory($this->randomBasedClass);
|
||||
}
|
||||
|
||||
public function timeBased(Uuid|string $node = null): TimeBasedUuidFactory
|
||||
public function timeBased(Uuid|string|null $node = null): TimeBasedUuidFactory
|
||||
{
|
||||
$node ??= $this->timeBasedNode;
|
||||
|
||||
@@ -67,7 +67,7 @@ class UuidFactory
|
||||
return new TimeBasedUuidFactory($this->timeBasedClass, $node);
|
||||
}
|
||||
|
||||
public function nameBased(Uuid|string $namespace = null): NameBasedUuidFactory
|
||||
public function nameBased(Uuid|string|null $namespace = null): NameBasedUuidFactory
|
||||
{
|
||||
$namespace ??= $this->nameBasedNamespace;
|
||||
|
||||
|
||||
4
vendor/symfony/uid/Ulid.php
vendored
4
vendor/symfony/uid/Ulid.php
vendored
@@ -26,7 +26,7 @@ class Ulid extends AbstractUid implements TimeBasedUidInterface
|
||||
private static string $time = '';
|
||||
private static array $rand = [];
|
||||
|
||||
public function __construct(string $ulid = null)
|
||||
public function __construct(?string $ulid = null)
|
||||
{
|
||||
if (null === $ulid) {
|
||||
$this->uid = static::generate();
|
||||
@@ -148,7 +148,7 @@ class Ulid extends AbstractUid implements TimeBasedUidInterface
|
||||
return \DateTimeImmutable::createFromFormat('U.u', substr_replace($time, '.', -3, 0));
|
||||
}
|
||||
|
||||
public static function generate(\DateTimeInterface $time = null): string
|
||||
public static function generate(?\DateTimeInterface $time = null): string
|
||||
{
|
||||
if (null === $mtime = $time) {
|
||||
$time = microtime(false);
|
||||
|
||||
6
vendor/symfony/uid/Uuid.php
vendored
6
vendor/symfony/uid/Uuid.php
vendored
@@ -14,7 +14,7 @@ namespace Symfony\Component\Uid;
|
||||
/**
|
||||
* @author Grégoire Pineau <lyrixx@lyrixx.info>
|
||||
*
|
||||
* @see https://tools.ietf.org/html/rfc4122#appendix-C for details about namespaces
|
||||
* @see https://datatracker.ietf.org/doc/html/rfc9562/#section-6.6 for details about namespaces
|
||||
*/
|
||||
class Uuid extends AbstractUid
|
||||
{
|
||||
@@ -153,9 +153,9 @@ class Uuid extends AbstractUid
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the identifier as a RFC4122 case insensitive string.
|
||||
* Returns the identifier as a RFC 9562/4122 case insensitive string.
|
||||
*
|
||||
* @see https://tools.ietf.org/html/rfc4122#section-3
|
||||
* @see https://datatracker.ietf.org/doc/html/rfc9562/#section-4
|
||||
*
|
||||
* @example 09748193-048a-4bfb-b825-8528cf74fdc1 (len=36)
|
||||
*/
|
||||
|
||||
6
vendor/symfony/uid/UuidV1.php
vendored
6
vendor/symfony/uid/UuidV1.php
vendored
@@ -22,10 +22,10 @@ class UuidV1 extends Uuid implements TimeBasedUidInterface
|
||||
|
||||
private static string $clockSeq;
|
||||
|
||||
public function __construct(string $uuid = null)
|
||||
public function __construct(?string $uuid = null)
|
||||
{
|
||||
if (null === $uuid) {
|
||||
$this->uid = uuid_create(static::TYPE);
|
||||
$this->uid = strtolower(uuid_create(static::TYPE));
|
||||
} else {
|
||||
parent::__construct($uuid, true);
|
||||
}
|
||||
@@ -41,7 +41,7 @@ class UuidV1 extends Uuid implements TimeBasedUidInterface
|
||||
return uuid_mac($this->uid);
|
||||
}
|
||||
|
||||
public static function generate(\DateTimeInterface $time = null, Uuid $node = null): string
|
||||
public static function generate(?\DateTimeInterface $time = null, ?Uuid $node = null): string
|
||||
{
|
||||
$uuid = !$time || !$node ? uuid_create(static::TYPE) : parent::NIL;
|
||||
|
||||
|
||||
2
vendor/symfony/uid/UuidV4.php
vendored
2
vendor/symfony/uid/UuidV4.php
vendored
@@ -20,7 +20,7 @@ class UuidV4 extends Uuid
|
||||
{
|
||||
protected const TYPE = 4;
|
||||
|
||||
public function __construct(string $uuid = null)
|
||||
public function __construct(?string $uuid = null)
|
||||
{
|
||||
if (null === $uuid) {
|
||||
$uuid = random_bytes(16);
|
||||
|
||||
4
vendor/symfony/uid/UuidV6.php
vendored
4
vendor/symfony/uid/UuidV6.php
vendored
@@ -24,7 +24,7 @@ class UuidV6 extends Uuid implements TimeBasedUidInterface
|
||||
|
||||
private static string $node;
|
||||
|
||||
public function __construct(string $uuid = null)
|
||||
public function __construct(?string $uuid = null)
|
||||
{
|
||||
if (null === $uuid) {
|
||||
$this->uid = static::generate();
|
||||
@@ -43,7 +43,7 @@ class UuidV6 extends Uuid implements TimeBasedUidInterface
|
||||
return substr($this->uid, 24);
|
||||
}
|
||||
|
||||
public static function generate(\DateTimeInterface $time = null, Uuid $node = null): string
|
||||
public static function generate(?\DateTimeInterface $time = null, ?Uuid $node = null): string
|
||||
{
|
||||
$uuidV1 = UuidV1::generate($time, $node);
|
||||
$uuid = substr($uuidV1, 15, 3).substr($uuidV1, 9, 4).$uuidV1[0].'-'.substr($uuidV1, 1, 4).'-6'.substr($uuidV1, 5, 3).substr($uuidV1, 18, 6);
|
||||
|
||||
4
vendor/symfony/uid/UuidV7.php
vendored
4
vendor/symfony/uid/UuidV7.php
vendored
@@ -28,7 +28,7 @@ class UuidV7 extends Uuid implements TimeBasedUidInterface
|
||||
private static array $seedParts;
|
||||
private static int $seedIndex = 0;
|
||||
|
||||
public function __construct(string $uuid = null)
|
||||
public function __construct(?string $uuid = null)
|
||||
{
|
||||
if (null === $uuid) {
|
||||
$this->uid = static::generate();
|
||||
@@ -49,7 +49,7 @@ class UuidV7 extends Uuid implements TimeBasedUidInterface
|
||||
return \DateTimeImmutable::createFromFormat('U.v', substr_replace($time, '.', -3, 0));
|
||||
}
|
||||
|
||||
public static function generate(\DateTimeInterface $time = null): string
|
||||
public static function generate(?\DateTimeInterface $time = null): string
|
||||
{
|
||||
if (null === $mtime = $time) {
|
||||
$time = microtime(false);
|
||||
|
||||
Reference in New Issue
Block a user