Skip to content

Commit 17da16a

Browse files
CS fixes
1 parent 9c8592d commit 17da16a

File tree

9 files changed

+22
-22
lines changed

9 files changed

+22
-22
lines changed

AbstractUid.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ abstract public function toBinary(): string;
9595
*/
9696
public function toBase58(): string
9797
{
98-
return strtr(sprintf('%022s', BinaryUtil::toBase($this->toBinary(), BinaryUtil::BASE58)), '0', '1');
98+
return strtr(\sprintf('%022s', BinaryUtil::toBase($this->toBinary(), BinaryUtil::BASE58)), '0', '1');
9999
}
100100

101101
/**
@@ -108,7 +108,7 @@ public function toBase58(): string
108108
public function toBase32(): string
109109
{
110110
$uid = bin2hex($this->toBinary());
111-
$uid = sprintf('%02s%04s%04s%04s%04s%04s%04s',
111+
$uid = \sprintf('%02s%04s%04s%04s%04s%04s%04s',
112112
base_convert(substr($uid, 0, 2), 16, 32),
113113
base_convert(substr($uid, 2, 5), 16, 32),
114114
base_convert(substr($uid, 7, 5), 16, 32),

Command/GenerateUlidCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ protected function configure(): void
4040
->setDefinition([
4141
new InputOption('time', null, InputOption::VALUE_REQUIRED, 'The ULID timestamp: a parsable date/time string'),
4242
new InputOption('count', 'c', InputOption::VALUE_REQUIRED, 'The number of ULID to generate', 1),
43-
new InputOption('format', 'f', InputOption::VALUE_REQUIRED, sprintf('The ULID output format ("%s")', implode('", "', $this->getAvailableFormatOptions())), 'base32'),
43+
new InputOption('format', 'f', InputOption::VALUE_REQUIRED, \sprintf('The ULID output format ("%s")', implode('", "', $this->getAvailableFormatOptions())), 'base32'),
4444
])
4545
->setHelp(<<<'EOF'
4646
The <info>%command.name%</info> command generates a ULID.
@@ -71,7 +71,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
7171
try {
7272
$time = new \DateTimeImmutable($time);
7373
} catch (\Exception $e) {
74-
$io->error(sprintf('Invalid timestamp "%s": %s', $time, str_replace('DateTimeImmutable::__construct(): ', '', $e->getMessage())));
74+
$io->error(\sprintf('Invalid timestamp "%s": %s', $time, str_replace('DateTimeImmutable::__construct(): ', '', $e->getMessage())));
7575

7676
return 1;
7777
}
@@ -82,7 +82,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8282
if (\in_array($formatOption, $this->getAvailableFormatOptions())) {
8383
$format = 'to'.ucfirst($formatOption);
8484
} else {
85-
$io->error(sprintf('Invalid format "%s", supported formats are "%s".', $formatOption, implode('", "', $this->getAvailableFormatOptions())));
85+
$io->error(\sprintf('Invalid format "%s", supported formats are "%s".', $formatOption, implode('", "', $this->getAvailableFormatOptions())));
8686

8787
return 1;
8888
}

Command/GenerateUuidCommand.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ protected function configure(): void
4545
new InputOption('namespace', null, InputOption::VALUE_REQUIRED, 'The UUID to use at the namespace for named-based UUIDs, predefined namespaces keywords "dns", "url", "oid" and "x500" are accepted'),
4646
new InputOption('random-based', null, InputOption::VALUE_NONE, 'To generate a random-based UUID'),
4747
new InputOption('count', 'c', InputOption::VALUE_REQUIRED, 'The number of UUID to generate', 1),
48-
new InputOption('format', 'f', InputOption::VALUE_REQUIRED, sprintf('The UUID output format ("%s")', implode('", "', $this->getAvailableFormatOptions())), 'rfc4122'),
48+
new InputOption('format', 'f', InputOption::VALUE_REQUIRED, \sprintf('The UUID output format ("%s")', implode('", "', $this->getAvailableFormatOptions())), 'rfc4122'),
4949
])
5050
->setHelp(<<<'EOF'
5151
The <info>%command.name%</info> generates a UUID.
@@ -118,7 +118,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
118118
try {
119119
$node = Uuid::fromString($node);
120120
} catch (\InvalidArgumentException $e) {
121-
$io->error(sprintf('Invalid node "%s": %s', $node, $e->getMessage()));
121+
$io->error(\sprintf('Invalid node "%s": %s', $node, $e->getMessage()));
122122

123123
return 1;
124124
}
@@ -127,7 +127,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
127127
try {
128128
new \DateTimeImmutable($time);
129129
} catch (\Exception $e) {
130-
$io->error(sprintf('Invalid timestamp "%s": %s', $time, str_replace('DateTimeImmutable::__construct(): ', '', $e->getMessage())));
130+
$io->error(\sprintf('Invalid timestamp "%s": %s', $time, str_replace('DateTimeImmutable::__construct(): ', '', $e->getMessage())));
131131

132132
return 1;
133133
}
@@ -140,7 +140,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
140140
try {
141141
$namespace = Uuid::fromString($namespace);
142142
} catch (\InvalidArgumentException $e) {
143-
$io->error(sprintf('Invalid namespace "%s": %s', $namespace, $e->getMessage()));
143+
$io->error(\sprintf('Invalid namespace "%s": %s', $namespace, $e->getMessage()));
144144

145145
return 1;
146146
}
@@ -171,7 +171,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
171171
if (\in_array($formatOption, $this->getAvailableFormatOptions())) {
172172
$format = 'to'.ucfirst($formatOption);
173173
} else {
174-
$io->error(sprintf('Invalid format "%s", supported formats are "%s".', $formatOption, implode('", "', $this->getAvailableFormatOptions())));
174+
$io->error(\sprintf('Invalid format "%s", supported formats are "%s".', $formatOption, implode('", "', $this->getAvailableFormatOptions())));
175175

176176
return 1;
177177
}

Factory/UuidFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function nameBased(Uuid|string|null $namespace = null): NameBasedUuidFact
7272
$namespace ??= $this->nameBasedNamespace;
7373

7474
if (null === $namespace) {
75-
throw new \LogicException(sprintf('A namespace should be defined when using "%s()".', __METHOD__));
75+
throw new \LogicException(\sprintf('A namespace should be defined when using "%s()".', __METHOD__));
7676
}
7777

7878
return new NameBasedUuidFactory($this->nameBasedClass, $this->getNamespace($namespace));

Ulid.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function __construct(?string $ulid = null)
3636
$this->uid = $ulid;
3737
} else {
3838
if (!self::isValid($ulid)) {
39-
throw new \InvalidArgumentException(sprintf('Invalid ULID: "%s".', $ulid));
39+
throw new \InvalidArgumentException(\sprintf('Invalid ULID: "%s".', $ulid));
4040
}
4141

4242
$this->uid = strtoupper($ulid);
@@ -73,7 +73,7 @@ public static function fromString(string $ulid): static
7373
}
7474

7575
$ulid = bin2hex($ulid);
76-
$ulid = sprintf('%02s%04s%04s%04s%04s%04s%04s',
76+
$ulid = \sprintf('%02s%04s%04s%04s%04s%04s%04s',
7777
base_convert(substr($ulid, 0, 2), 16, 32),
7878
base_convert(substr($ulid, 2, 5), 16, 32),
7979
base_convert(substr($ulid, 7, 5), 16, 32),
@@ -101,7 +101,7 @@ public function toBinary(): string
101101
{
102102
$ulid = strtr($this->uid, 'ABCDEFGHJKMNPQRSTVWXYZ', 'abcdefghijklmnopqrstuv');
103103

104-
$ulid = sprintf('%02s%05s%05s%05s%05s%05s%05s',
104+
$ulid = \sprintf('%02s%05s%05s%05s%05s%05s%05s',
105105
base_convert(substr($ulid, 0, 2), 32, 16),
106106
base_convert(substr($ulid, 2, 4), 32, 16),
107107
base_convert(substr($ulid, 6, 4), 32, 16),
@@ -133,7 +133,7 @@ public function getDateTime(): \DateTimeImmutable
133133
if (\PHP_INT_SIZE >= 8) {
134134
$time = (string) hexdec(base_convert($time, 32, 16));
135135
} else {
136-
$time = sprintf('%02s%05s%05s',
136+
$time = \sprintf('%02s%05s%05s',
137137
base_convert(substr($time, 0, 2), 32, 16),
138138
base_convert(substr($time, 2, 4), 32, 16),
139139
base_convert(substr($time, 6, 4), 32, 16)
@@ -190,14 +190,14 @@ public static function generate(?\DateTimeInterface $time = null): string
190190
$time = base_convert($time, 10, 32);
191191
} else {
192192
$time = str_pad(bin2hex(BinaryUtil::fromBase($time, BinaryUtil::BASE10)), 12, '0', \STR_PAD_LEFT);
193-
$time = sprintf('%s%04s%04s',
193+
$time = \sprintf('%s%04s%04s',
194194
base_convert(substr($time, 0, 2), 16, 32),
195195
base_convert(substr($time, 2, 5), 16, 32),
196196
base_convert(substr($time, 7, 5), 16, 32)
197197
);
198198
}
199199

200-
return strtr(sprintf('%010s%04s%04s%04s%04s',
200+
return strtr(\sprintf('%010s%04s%04s%04s%04s',
201201
$time,
202202
base_convert(self::$rand[1], 10, 32),
203203
base_convert(self::$rand[2], 10, 32),

Uuid.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ public function __construct(string $uuid, bool $checkVariant = false)
3232
$type = preg_match('{^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$}Di', $uuid) ? (int) $uuid[14] : false;
3333

3434
if (false === $type || (static::TYPE ?: $type) !== $type) {
35-
throw new \InvalidArgumentException(sprintf('Invalid UUID%s: "%s".', static::TYPE ? 'v'.static::TYPE : '', $uuid));
35+
throw new \InvalidArgumentException(\sprintf('Invalid UUID%s: "%s".', static::TYPE ? 'v'.static::TYPE : '', $uuid));
3636
}
3737

3838
$this->uid = strtolower($uuid);
3939

4040
if ($checkVariant && !\in_array($this->uid[19], ['8', '9', 'a', 'b'], true)) {
41-
throw new \InvalidArgumentException(sprintf('Invalid UUID%s: "%s".', static::TYPE ? 'v'.static::TYPE : '', $uuid));
41+
throw new \InvalidArgumentException(\sprintf('Invalid UUID%s: "%s".', static::TYPE ? 'v'.static::TYPE : '', $uuid));
4242
}
4343
}
4444

UuidV1.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public static function generate(?\DateTimeInterface $time = null, ?Uuid $node =
5454
$seq = substr($uuid, 19, 4);
5555

5656
do {
57-
self::$clockSeq = sprintf('%04x', random_int(0, 0x3FFF) | 0x8000);
57+
self::$clockSeq = \sprintf('%04x', random_int(0, 0x3FFF) | 0x8000);
5858
} while ($seq === self::$clockSeq);
5959

6060
$seq = self::$clockSeq;

UuidV6.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public static function generate(?\DateTimeInterface $time = null, ?Uuid $node =
5858
if (!isset(self::$node)) {
5959
$seed = [random_int(0, 0xFFFFFF), random_int(0, 0xFFFFFF)];
6060
$node = unpack('N2', hex2bin('00'.substr($uuidV1, 24, 6)).hex2bin('00'.substr($uuidV1, 30)));
61-
self::$node = sprintf('%06x%06x', ($seed[0] ^ $node[1]) | 0x010000, $seed[1] ^ $node[2]);
61+
self::$node = \sprintf('%06x%06x', ($seed[0] ^ $node[1]) | 0x010000, $seed[1] ^ $node[2]);
6262
}
6363

6464
return $uuid.self::$node;

UuidV7.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public static function generate(?\DateTimeInterface $time = null): string
113113
$time = bin2hex(BinaryUtil::fromBase($time, BinaryUtil::BASE10));
114114
}
115115

116-
return substr_replace(sprintf('%012s-%04x-%04x-%04x%04x%04x',
116+
return substr_replace(\sprintf('%012s-%04x-%04x-%04x%04x%04x',
117117
$time,
118118
0x7000 | (self::$rand[1] << 2) | (self::$rand[2] >> 14),
119119
0x8000 | (self::$rand[2] & 0x3FFF),

0 commit comments

Comments
 (0)