Skip to content

Commit 1607f54

Browse files
authored
Bump php-cs-fixer to version 3.60 (#1743)
1 parent bb0080e commit 1607f54

29 files changed

+84
-84
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"ext-SimpleXML": "*",
99
"ext-dom": "*",
1010
"ext-json": "*",
11-
"friendsofphp/php-cs-fixer": "~3.52.0",
11+
"friendsofphp/php-cs-fixer": "~3.60.0",
1212
"nette/php-generator": "^3.6 || ^4.1",
1313
"nette/utils": "^3.0 || ^4.0",
1414
"nikic/php-parser": "^4.0",

src/Command/GenerateCommand.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ private function extractEndpointsForService(array $endpoints, string $prefix, st
217217

218218
if (empty($config)) {
219219
if (!isset($serviceEndpoints['_default'][$partition['partition']])) {
220-
$endpoint = strtr(sprintf('http%s://%s', \in_array('https', $protocols) ? 's' : '', $hostname), [
220+
$endpoint = strtr(\sprintf('http%s://%s', \in_array('https', $protocols) ? 's' : '', $hostname), [
221221
'{service}' => $prefix,
222222
'{region}' => '%region%',
223223
'{dnsSuffix}' => $suffix,
@@ -232,7 +232,7 @@ private function extractEndpointsForService(array $endpoints, string $prefix, st
232232
$serviceEndpoints['_default'][$partition['partition']]['regions'][] = $region;
233233
}
234234
} else {
235-
$endpoint = strtr(sprintf('http%s://%s', \in_array('https', $protocols) ? 's' : '', $hostname), [
235+
$endpoint = strtr(\sprintf('http%s://%s', \in_array('https', $protocols) ? 's' : '', $hostname), [
236236
'{service}' => $prefix,
237237
'{region}' => $region,
238238
'{dnsSuffix}' => $suffix,
@@ -303,7 +303,7 @@ private function generateService(SymfonyStyle $io, InputInterface $input, array
303303

304304
$managedOperations = array_unique(array_merge($manifest['services'][$serviceName]['methods'], $operationNames));
305305
$definition = new ServiceDefinition($serviceName, $endpoints, $definitionArray, $documentationArray, $paginationArray, $waiterArray, $exampleArray, $manifest['services'][$serviceName]['hooks'] ?? [], $manifest['services'][$serviceName]['api-reference'] ?? null);
306-
$serviceGenerator = $this->generator->service($namespace = $manifest['services'][$serviceName]['namespace'] ?? sprintf('AsyncAws\\%s', $serviceName), $managedOperations);
306+
$serviceGenerator = $this->generator->service($namespace = $manifest['services'][$serviceName]['namespace'] ?? \sprintf('AsyncAws\\%s', $serviceName), $managedOperations);
307307

308308
$clientClass = $serviceGenerator->client()->generate($definition, $customErrorFactory);
309309

@@ -313,7 +313,7 @@ private function generateService(SymfonyStyle $io, InputInterface $input, array
313313
} elseif (null !== $waiter = $definition->getWaiter($operationName)) {
314314
$serviceGenerator->waiter()->generate($waiter);
315315
} else {
316-
$io->error(sprintf('Could not find service or waiter named "%s".', $operationName));
316+
$io->error(\sprintf('Could not find service or waiter named "%s".', $operationName));
317317

318318
return 1;
319319
}
@@ -351,7 +351,7 @@ private function getServiceNames(?string $inputServiceName, bool $returnAll, Sym
351351
{
352352
if ($inputServiceName) {
353353
if (!isset($manifest[$inputServiceName])) {
354-
$io->error(sprintf('Could not find service named "%s".', $inputServiceName));
354+
$io->error(\sprintf('Could not find service named "%s".', $inputServiceName));
355355

356356
return 1;
357357
}
@@ -384,19 +384,19 @@ private function getOperationNames(?string $inputOperationName, bool $returnAll,
384384
{
385385
if ($inputOperationName) {
386386
if ($returnAll) {
387-
$io->error(sprintf('Cannot use "--all" together with an operation. You passed "%s" as operation.', $inputOperationName));
387+
$io->error(\sprintf('Cannot use "--all" together with an operation. You passed "%s" as operation.', $inputOperationName));
388388

389389
return 1;
390390
}
391391

392392
if (!isset($definition['operations'][$inputOperationName]) && !isset($waiter['waiters'][$inputOperationName])) {
393-
$io->error(sprintf('Could not find operation or waiter named "%s".', $inputOperationName));
393+
$io->error(\sprintf('Could not find operation or waiter named "%s".', $inputOperationName));
394394

395395
return 1;
396396
}
397397

398398
if (!\in_array($inputOperationName, $manifest['methods'])) {
399-
$io->warning(sprintf('Operation named "%s" has never been generated.', $inputOperationName));
399+
$io->warning(\sprintf('Operation named "%s" has never been generated.', $inputOperationName));
400400
if (!$io->confirm('Do you want adding it?', true)) {
401401
return 1;
402402
}
@@ -434,10 +434,10 @@ private function fixCs(ClassName $clientClass, SymfonyStyle $io): void
434434
$testPath = substr($srcPath, 0, strrpos($srcPath, '/src')) . '/tests';
435435

436436
if (!is_dir($srcPath)) {
437-
throw new \InvalidArgumentException(sprintf('The src dir "%s" does not exists', $srcPath));
437+
throw new \InvalidArgumentException(\sprintf('The src dir "%s" does not exists', $srcPath));
438438
}
439439
if (!is_dir($testPath)) {
440-
throw new \InvalidArgumentException(sprintf('The test dir "%s" does not exists', $testPath));
440+
throw new \InvalidArgumentException(\sprintf('The test dir "%s" does not exists', $testPath));
441441
}
442442

443443
// assert this
@@ -480,7 +480,7 @@ private function fixCs(ClassName $clientClass, SymfonyStyle $io): void
480480
);
481481
$runner->fix();
482482
foreach ($e->getInvalidErrors() as $error) {
483-
$io->error(sprintf('The generated file "%s" is invalid: %s', $error->getFilePath(), $error->getSource() ? $error->getSource()->getMessage() : 'unknown'));
483+
$io->error(\sprintf('The generated file "%s" is invalid: %s', $error->getFilePath(), $error->getSource() ? $error->getSource()->getMessage() : 'unknown'));
484484
}
485485
if (empty($e->getInvalidErrors())) {
486486
$runner->fix();

src/Definition/ErrorWaiterAcceptor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public function getError(): ExceptionShape
1414
$shape = ($this->shapeLocator)($this->data['expected']);
1515

1616
if (!$shape instanceof ExceptionShape) {
17-
throw new \InvalidArgumentException(sprintf('The error "%s" of the waiter acceptor should have an Exception shape.', $this->data['expected']));
17+
throw new \InvalidArgumentException(\sprintf('The error "%s" of the waiter acceptor should have an Exception shape.', $this->data['expected']));
1818
}
1919

2020
return $shape;

src/Definition/Operation.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public function getOutput(): ?StructureShape
103103
$shape = ($this->shapeLocator)($this->data['output']['shape'], null, ['resultWrapper' => $this->data['output']['resultWrapper'] ?? null]);
104104

105105
if (!$shape instanceof StructureShape) {
106-
throw new \InvalidArgumentException(sprintf('The operation "%s" should have an Structure output.', $this->getName()));
106+
throw new \InvalidArgumentException(\sprintf('The operation "%s" should have an Structure output.', $this->getName()));
107107
}
108108

109109
return $shape;
@@ -124,7 +124,7 @@ public function getErrors(): array
124124
}
125125
$shape = ($this->shapeLocator)($error['shape']);
126126
if (!$shape instanceof ExceptionShape) {
127-
throw new \InvalidArgumentException(sprintf('The error "%s" of the operation "%s" should have an Exception shape.', $error['shape'], $this->getName()));
127+
throw new \InvalidArgumentException(\sprintf('The error "%s" of the operation "%s" should have an Exception shape.', $error['shape'], $this->getName()));
128128
}
129129

130130
$errors[$error['shape']] = $shape;
@@ -138,7 +138,7 @@ public function getInput(): StructureShape
138138
$shape = $this->getInputShape();
139139

140140
if (!$shape instanceof StructureShape) {
141-
throw new \InvalidArgumentException(sprintf('The operation "%s" should have an Structure Input.', $this->getName()));
141+
throw new \InvalidArgumentException(\sprintf('The operation "%s" should have an Structure Input.', $this->getName()));
142142
}
143143

144144
return $shape;
@@ -172,7 +172,7 @@ public function getHttpRequestUri(): ?string
172172
public function getHttpMethod(): string
173173
{
174174
if (isset($this->data['input']['method'])) {
175-
throw new \InvalidArgumentException(sprintf('The operation "%s" should have an HTTP Method.', $this->getName()));
175+
throw new \InvalidArgumentException(\sprintf('The operation "%s" should have an HTTP Method.', $this->getName()));
176176
}
177177

178178
return $this->data['http']['method'];
@@ -215,7 +215,7 @@ private function getInputShape(): Shape
215215
}
216216

217217
return Shape::create(
218-
sprintf('%sRequest', $this->getName()),
218+
\sprintf('%sRequest', $this->getName()),
219219
['type' => 'structure', 'required' => [], 'members' => []],
220220
$this->shapeLocator,
221221
function () {

src/Definition/ServiceDefinition.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ private function getShape(string $name, ?Member $member, array $extra): Shape
202202
return Shape::create($name, $this->definition['shapes'][$name] + ['_documentation_main' => $documentationMain, '_documentation_member' => $documentationMember] + $extra, $this->createClosureToFindShape(), $this->createClosureToService());
203203
}
204204

205-
throw new \InvalidArgumentException(sprintf('The shape "%s" does not exist.', $name));
205+
throw new \InvalidArgumentException(\sprintf('The shape "%s" does not exist.', $name));
206206
}
207207

208208
/**
@@ -240,7 +240,7 @@ private function createClosureToFindOperation(): \Closure
240240
$operation = $definition->getOperation($name);
241241

242242
if (null === $operation) {
243-
throw new \InvalidArgumentException(sprintf('The operation "%s" is not defined.', $name));
243+
throw new \InvalidArgumentException(\sprintf('The operation "%s" is not defined.', $name));
244244
}
245245

246246
return $operation;

src/Definition/StructureShape.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function getMembers(): array
2929
public function getMember(string $name): StructureMember
3030
{
3131
if (!isset($this->data['members'][$name])) {
32-
throw new \InvalidArgumentException(sprintf('The member "%s" does not exists.', $name));
32+
throw new \InvalidArgumentException(\sprintf('The member "%s" does not exists.', $name));
3333
}
3434

3535
return new StructureMember(

src/File/ClassWriter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function write(ClassBuilder $classBuilder): void
4848
$className = $className->getName();
4949
$directory = $this->resolveDirectory($namespace);
5050

51-
$filename = sprintf('%s/%s.php', $directory, $className);
51+
$filename = \sprintf('%s/%s.php', $directory, $className);
5252

5353
$this->fileDumper->dump($filename, $content);
5454
}
@@ -58,7 +58,7 @@ private function resolveDirectory(string $namespace): string
5858
$directory = $this->directoryResolver->resolveDirectory($namespace);
5959
if (!is_dir($directory)) {
6060
if (false === mkdir($directory, 0777, true)) {
61-
throw new \RuntimeException(sprintf('Could not create directory "%s"', $directory));
61+
throw new \RuntimeException(\sprintf('Could not create directory "%s"', $directory));
6262
}
6363
}
6464

src/File/FileDumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ private function verifyFileSyntax(string $filename): void
4747
return;
4848
}
4949

50-
throw new RuntimeException(sprintf('Could not generate file "%s" due invalid syntax.' . "\n\n%s", $filename, $process->getErrorOutput()));
50+
throw new RuntimeException(\sprintf('Could not generate file "%s" due invalid syntax.' . "\n\n%s", $filename, $process->getErrorOutput()));
5151
}
5252

5353
private function moveFile(string $from, string $to): void

src/File/Location/AsyncAwsMonoRepoResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ public function resolveDirectory(string $namespace): string
3333
array_unshift($parts, 'Service');
3434
}
3535

36-
return sprintf('%s/%s', $this->srcDirectory, implode('/', $parts));
36+
return \sprintf('%s/%s', $this->srcDirectory, implode('/', $parts));
3737
}
3838
}

src/File/Location/StandalonePackageResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@ public function resolveDirectory(string $namespace): string
4040
array_unshift($parts, 'src');
4141
}
4242

43-
return sprintf('%s/%s', $this->rootDirectory, implode('/', $parts));
43+
return \sprintf('%s/%s', $this->rootDirectory, implode('/', $parts));
4444
}
4545
}

0 commit comments

Comments
 (0)