Skip to content

Commit ccd60fd

Browse files
CS fixes
1 parent d55b183 commit ccd60fd

26 files changed

+71
-71
lines changed

Caster/DateCaster.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,16 +105,16 @@ public static function castPeriod(\DatePeriod $p, array $a, Stub $stub, bool $is
105105
foreach (clone $p as $i => $d) {
106106
if (self::PERIOD_LIMIT === $i) {
107107
$now = new \DateTimeImmutable('now', new \DateTimeZone('UTC'));
108-
$dates[] = sprintf('%s more', ($end = $p->getEndDate())
108+
$dates[] = \sprintf('%s more', ($end = $p->getEndDate())
109109
? ceil(($end->format('U.u') - $d->format('U.u')) / ((int) $now->add($p->getDateInterval())->format('U.u') - (int) $now->format('U.u')))
110110
: $p->recurrences - $i
111111
);
112112
break;
113113
}
114-
$dates[] = sprintf('%s) %s', $i + 1, self::formatDateTime($d));
114+
$dates[] = \sprintf('%s) %s', $i + 1, self::formatDateTime($d));
115115
}
116116

117-
$period = sprintf(
117+
$period = \sprintf(
118118
'every %s, from %s%s %s',
119119
self::formatInterval($p->getDateInterval()),
120120
$p->include_start_date ? '[' : ']',
@@ -134,6 +134,6 @@ private static function formatDateTime(\DateTimeInterface $d, string $extra = ''
134134

135135
private static function formatSeconds(string $s, string $us): string
136136
{
137-
return sprintf('%02d.%s', $s, 0 === ($len = \strlen($t = rtrim($us, '0'))) ? '0' : ($len <= 3 ? str_pad($t, 3, '0') : $us));
137+
return \sprintf('%02d.%s', $s, 0 === ($len = \strlen($t = rtrim($us, '0'))) ? '0' : ($len <= 3 ? str_pad($t, 3, '0') : $us));
138138
}
139139
}

Caster/ExceptionCaster.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ public static function castTraceStub(TraceStub $trace, array $a, Stub $stub, boo
192192
} else {
193193
$label = substr_replace($prefix, "title=Stack level $j.", 2, 0).$lastCall;
194194
}
195-
$a[substr_replace($label, sprintf('separator=%s&', $frame instanceof EnumStub ? ' ' : ':'), 2, 0)] = $frame;
195+
$a[substr_replace($label, \sprintf('separator=%s&', $frame instanceof EnumStub ? ' ' : ':'), 2, 0)] = $frame;
196196

197197
$lastCall = $call;
198198
}
@@ -240,7 +240,7 @@ public static function castFrameStub(FrameStub $frame, array $a, Stub $stub, boo
240240
if (isset($f['object'])) {
241241
$template = $f['object'];
242242
} elseif ((new \ReflectionClass($f['class']))->isInstantiable()) {
243-
$template = unserialize(sprintf('O:%d:"%s":0:{}', \strlen($f['class']), $f['class']));
243+
$template = unserialize(\sprintf('O:%d:"%s":0:{}', \strlen($f['class']), $f['class']));
244244
}
245245
if (null !== $template) {
246246
$ellipsis = 0;
@@ -264,7 +264,7 @@ public static function castFrameStub(FrameStub $frame, array $a, Stub $stub, boo
264264
$ellipsis += 1 + \strlen($f['line']);
265265
}
266266
}
267-
$srcAttr .= sprintf('&separator= &file=%s&line=%d', rawurlencode($f['file']), $f['line']);
267+
$srcAttr .= \sprintf('&separator= &file=%s&line=%d', rawurlencode($f['file']), $f['line']);
268268
} else {
269269
$srcAttr .= '&separator=:';
270270
}
@@ -295,7 +295,7 @@ public static function castFrameStub(FrameStub $frame, array $a, Stub $stub, boo
295295
public static function castFlattenException(FlattenException $e, array $a, Stub $stub, bool $isNested)
296296
{
297297
if ($isNested) {
298-
$k = sprintf(Caster::PATTERN_PRIVATE, FlattenException::class, 'traceAsString');
298+
$k = \sprintf(Caster::PATTERN_PRIVATE, FlattenException::class, 'traceAsString');
299299
$a[$k] = new CutStub($a[$k]);
300300
}
301301

@@ -411,7 +411,7 @@ private static function extractSource(string $srcLines, int $line, int $srcConte
411411
}
412412
}
413413
$c->attr['lang'] = $lang;
414-
$srcLines[sprintf("\0~separator=› &%d\0", $i + $line - $srcContext)] = $c;
414+
$srcLines[\sprintf("\0~separator=› &%d\0", $i + $line - $srcContext)] = $c;
415415
}
416416

417417
return new EnumStub($srcLines);

Caster/FFICaster.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public static function castCTypeOrCData(CData|CType $data, array $args, Stub $st
4141
$type = \FFI::typeof($data);
4242
}
4343

44-
$stub->class = sprintf('%s<%s> size %d align %d', ($data ?? $type)::class, $type->getName(), $type->getSize(), $type->getAlignment());
44+
$stub->class = \sprintf('%s<%s> size %d align %d', ($data ?? $type)::class, $type->getName(), $type->getSize(), $type->getAlignment());
4545

4646
return match ($type->getKind()) {
4747
CType::TYPE_FLOAT,
@@ -86,7 +86,7 @@ private static function castFFIFunction(Stub $stub, CType $type): array
8686
CType::ABI_MS => '[ms]',
8787
CType::ABI_SYSV => '[sysv]',
8888
CType::ABI_VECTORCALL => '[vectorcall]',
89-
default => '[unknown abi]'
89+
default => '[unknown abi]',
9090
};
9191

9292
$returnType = $type->getFuncReturnType();

Caster/PgSqlCaster.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ public static function castResult($result, array $a, Stub $stub, bool $isNested)
140140
for ($i = 0; $i < $fields; ++$i) {
141141
$field = [
142142
'name' => pg_field_name($result, $i),
143-
'table' => sprintf('%s (OID: %s)', pg_field_table($result, $i), pg_field_table($result, $i, true)),
144-
'type' => sprintf('%s (OID: %s)', pg_field_type($result, $i), pg_field_type_oid($result, $i)),
143+
'table' => \sprintf('%s (OID: %s)', pg_field_table($result, $i), pg_field_table($result, $i, true)),
144+
'type' => \sprintf('%s (OID: %s)', pg_field_type($result, $i), pg_field_type_oid($result, $i)),
145145
'nullable' => (bool) (\PHP_VERSION_ID >= 80300 ? pg_field_is_null($result, null, $i) : pg_field_is_null($result, $i)),
146146
'storage' => pg_field_size($result, $i).' bytes',
147147
'display' => (\PHP_VERSION_ID >= 80300 ? pg_field_prtlen($result, null, $i) : pg_field_prtlen($result, $i)).' chars',

Caster/SplCaster.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public static function castFileInfo(\SplFileInfo $c, array $a, Stub $stub, bool
141141
}
142142

143143
if (isset($a[$prefix.'perms'])) {
144-
$a[$prefix.'perms'] = new ConstStub(sprintf('0%o', $a[$prefix.'perms']), $a[$prefix.'perms']);
144+
$a[$prefix.'perms'] = new ConstStub(\sprintf('0%o', $a[$prefix.'perms']), $a[$prefix.'perms']);
145145
}
146146

147147
static $mapDate = ['aTime', 'mTime', 'cTime'];
@@ -208,7 +208,7 @@ public static function castObjectStorage(\SplObjectStorage $c, array $a, Stub $s
208208
$storage[] = new EnumStub([
209209
'object' => $obj,
210210
'info' => $clone->getInfo(),
211-
]);
211+
]);
212212
}
213213

214214
$a += [
@@ -249,7 +249,7 @@ public static function castWeakMap(\WeakMap $c, array $a, Stub $stub, bool $isNe
249249
$map[] = new EnumStub([
250250
'object' => $obj,
251251
'data' => $data,
252-
]);
252+
]);
253253
}
254254

255255
$a += [

Caster/SymfonyCaster.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public static function castRequest(Request $request, array $a, Stub $stub, bool
5454
*/
5555
public static function castHttpClient($client, array $a, Stub $stub, bool $isNested)
5656
{
57-
$multiKey = sprintf("\0%s\0multi", $client::class);
57+
$multiKey = \sprintf("\0%s\0multi", $client::class);
5858
if (isset($a[$multiKey])) {
5959
$a[$multiKey] = new CutStub($a[$multiKey]);
6060
}

Cloner/Data.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public function count(): int
115115
public function getIterator(): \Traversable
116116
{
117117
if (!\is_array($value = $this->getValue())) {
118-
throw new \LogicException(sprintf('"%s" object holds non-iterable type "%s".', self::class, get_debug_type($value)));
118+
throw new \LogicException(\sprintf('"%s" object holds non-iterable type "%s".', self::class, get_debug_type($value)));
119119
}
120120

121121
yield from $value;
@@ -168,7 +168,7 @@ public function __toString(): string
168168
return (string) $value;
169169
}
170170

171-
return sprintf('%s (count=%d)', $this->getType(), \count($value));
171+
return \sprintf('%s (count=%d)', $this->getType(), \count($value));
172172
}
173173

174174
/**
@@ -375,7 +375,7 @@ private function dumpItem(DumperInterface $dumper, Cursor $cursor, array &$refs,
375375
break;
376376

377377
default:
378-
throw new \RuntimeException(sprintf('Unexpected Stub type: "%s".', $item->type));
378+
throw new \RuntimeException(\sprintf('Unexpected Stub type: "%s".', $item->type));
379379
}
380380
} elseif ('array' === $type) {
381381
$dumper->enterHash($cursor, Cursor::HASH_INDEXED, 0, false);

Command/Descriptor/CliDescriptor.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function describe(OutputInterface $output, Data $data, array $context, in
4747
if (isset($context['request'])) {
4848
$request = $context['request'];
4949
$this->lastIdentifier = $request['identifier'];
50-
$section = sprintf('%s %s', $request['method'], $request['uri']);
50+
$section = \sprintf('%s %s', $request['method'], $request['uri']);
5151
if ($controller = $request['controller']) {
5252
$rows[] = ['controller', rtrim($this->dumper->dump($controller, true), "\n")];
5353
}
@@ -62,9 +62,9 @@ public function describe(OutputInterface $output, Data $data, array $context, in
6262

6363
if (isset($context['source'])) {
6464
$source = $context['source'];
65-
$sourceInfo = sprintf('%s on line %d', $source['name'], $source['line']);
65+
$sourceInfo = \sprintf('%s on line %d', $source['name'], $source['line']);
6666
if ($fileLink = $source['file_link'] ?? null) {
67-
$sourceInfo = sprintf('<href=%s>%s</>', $fileLink, $sourceInfo);
67+
$sourceInfo = \sprintf('<href=%s>%s</>', $fileLink, $sourceInfo);
6868
}
6969
$rows[] = ['source', $sourceInfo];
7070
$file = $source['file_relative'] ?? $source['file'];

Command/Descriptor/HtmlDescriptor.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function describe(OutputInterface $output, Data $data, array $context, in
4545
if (isset($context['request'])) {
4646
$request = $context['request'];
4747
$controller = "<span class='dumped-tag'>{$this->dumper->dump($request['controller'], true, ['maxDepth' => 0])}</span>";
48-
$title = sprintf('<code>%s</code> <a href="%s">%s</a>', $request['method'], $uri = $request['uri'], $uri);
48+
$title = \sprintf('<code>%s</code> <a href="%s">%s</a>', $request['method'], $uri = $request['uri'], $uri);
4949
$dedupIdentifier = $request['identifier'];
5050
} elseif (isset($context['cli'])) {
5151
$title = '<code>$ </code>'.$context['cli']['command_line'];
@@ -58,9 +58,9 @@ public function describe(OutputInterface $output, Data $data, array $context, in
5858
if (isset($context['source'])) {
5959
$source = $context['source'];
6060
$projectDir = $source['project_dir'] ?? null;
61-
$sourceDescription = sprintf('%s on line %d', $source['name'], $source['line']);
61+
$sourceDescription = \sprintf('%s on line %d', $source['name'], $source['line']);
6262
if (isset($source['file_link'])) {
63-
$sourceDescription = sprintf('<a href="%s">%s</a>', $source['file_link'], $sourceDescription);
63+
$sourceDescription = \sprintf('<a href="%s">%s</a>', $source['file_link'], $sourceDescription);
6464
}
6565
}
6666

@@ -105,7 +105,7 @@ private function renderTags(array $tags): string
105105

106106
$renderedTags = '';
107107
foreach ($tags as $key => $value) {
108-
$renderedTags .= sprintf('<li><span class="badge">%s</span>%s</li>', $key, $value);
108+
$renderedTags .= \sprintf('<li><span class="badge">%s</span>%s</li>', $key, $value);
109109
}
110110

111111
return <<<HTML

Command/ServerDumpCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function __construct(DumpServer $server, array $descriptors = [])
5757
protected function configure(): void
5858
{
5959
$this
60-
->addOption('format', null, InputOption::VALUE_REQUIRED, sprintf('The output format (%s)', implode(', ', $this->getAvailableFormats())), 'cli')
60+
->addOption('format', null, InputOption::VALUE_REQUIRED, \sprintf('The output format (%s)', implode(', ', $this->getAvailableFormats())), 'cli')
6161
->setHelp(<<<'EOF'
6262
<info>%command.name%</info> starts a dump server that collects and displays
6363
dumps in a single place for debugging you application:
@@ -80,15 +80,15 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8080
$format = $input->getOption('format');
8181

8282
if (!$descriptor = $this->descriptors[$format] ?? null) {
83-
throw new InvalidArgumentException(sprintf('Unsupported format "%s".', $format));
83+
throw new InvalidArgumentException(\sprintf('Unsupported format "%s".', $format));
8484
}
8585

8686
$errorIo = $io->getErrorStyle();
8787
$errorIo->title('Symfony Var Dumper Server');
8888

8989
$this->server->start();
9090

91-
$errorIo->success(sprintf('Server listening on %s', $this->server->getHost()));
91+
$errorIo->success(\sprintf('Server listening on %s', $this->server->getHost()));
9292
$errorIo->comment('Quit the server with CONTROL-C.');
9393

9494
$this->server->listen(function (Data $data, array $context, int $clientId) use ($descriptor, $io) {

0 commit comments

Comments
 (0)