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
}

src/Generator/ClientGenerator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function generate(ServiceDefinition $definition, ?string $customErrorFact
5959
}
6060
$classBuilder = $this->classRegistry->register($className->getFqdn(), true);
6161

62-
$supportedVersions = eval(sprintf('class A%s extends %s {
62+
$supportedVersions = eval(\sprintf('class A%s extends %s {
6363
public function __construct() {}
6464
public function getVersion() {
6565
return array_keys($this->getSignerFactories());
@@ -232,7 +232,7 @@ public function getVersion() {
232232
$code = $regionConfig['code'];
233233
$regions = $regionConfig['regions'];
234234
foreach ($regions as $region) {
235-
$body .= sprintf(" case %s:\n", var_export($region, true));
235+
$body .= \sprintf(" case %s:\n", var_export($region, true));
236236
}
237237
$body .= $code;
238238
}
@@ -277,7 +277,7 @@ public function getVersion() {
277277

278278
break;
279279
default:
280-
throw new \LogicException(sprintf('Parser for "%s" is not implemented yet', $definition->getProtocol()));
280+
throw new \LogicException(\sprintf('Parser for "%s" is not implemented yet', $definition->getProtocol()));
281281
}
282282
}
283283

src/Generator/CodeGenerator/PopulatorGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ private function generatePopulator(Operation $operation, StructureShape $shape,
221221

222222
break;
223223
default:
224-
throw new \RuntimeException(sprintf('Type %s is not yet implemented', $memberShape->getType()));
224+
throw new \RuntimeException(\sprintf('Type %s is not yet implemented', $memberShape->getType()));
225225
}
226226
}
227227

src/Generator/CodeGenerator/TypeGenerator.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,13 @@ public function generateDocblock(StructureShape $shape, ClassName $shapeClassNam
113113
}
114114

115115
if ($nullable) {
116-
$body[] = sprintf(' %s?: %s,', $phpdocMemberName, 'null|' . $param);
116+
$body[] = \sprintf(' %s?: %s,', $phpdocMemberName, 'null|' . $param);
117117
} elseif ($allNullable) {
118118
// For input objects, the constructor allows to omit all members to set them later. But when provided,
119119
// they should respect the nullability of the member.
120-
$body[] = sprintf(' %s?: %s,', $phpdocMemberName, $param);
120+
$body[] = \sprintf(' %s?: %s,', $phpdocMemberName, $param);
121121
} else {
122-
$body[] = sprintf(' %s: %s,', $phpdocMemberName, $param);
122+
$body[] = \sprintf(' %s: %s,', $phpdocMemberName, $param);
123123
}
124124
}
125125
$body = array_merge($body, $extra);
@@ -199,7 +199,7 @@ private function getNativePhpType(string $parameterType): string
199199
case 'timestamp':
200200
return '\DateTimeImmutable';
201201
default:
202-
throw new \RuntimeException(sprintf('Type %s is not yet implemented', $parameterType));
202+
throw new \RuntimeException(\sprintf('Type %s is not yet implemented', $parameterType));
203203
}
204204
}
205205
}

src/Generator/GeneratorHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public static function normalizeName(string $propertyName): string
7676
if (preg_match('/[A-Z]{2,}/', $propertyName)) {
7777
$propertyName = strtr($propertyName, $ignored);
7878
if (preg_match('/[A-Z]{2,}/', $propertyName)) {
79-
throw new \RuntimeException(sprintf('No camel case property "%s" is not yet implemented', $originalPropertyName));
79+
throw new \RuntimeException(\sprintf('No camel case property "%s" is not yet implemented', $originalPropertyName));
8080
}
8181
}
8282

src/Generator/InputGenerator.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ private function inputClassRequestPartGetters(StructureMember $member, ClassBuil
349349
$memberShape = $member->getShape();
350350
if ($memberShape instanceof ListShape) {
351351
if ('header' !== $requestPart) {
352-
throw new \InvalidArgumentException(sprintf('ListShape in request part "%s" is not yet implemented', $requestPart));
352+
throw new \InvalidArgumentException(\sprintf('ListShape in request part "%s" is not yet implemented', $requestPart));
353353
}
354354

355355
$bodyCode = '
@@ -451,7 +451,7 @@ private function inputClassRequestGetters(StructureShape $inputShape, ClassBuild
451451
$memberShape = $member->getShape();
452452
$inputElement = '$this->' . GeneratorHelper::normalizeName($member->getName());
453453
if (!$memberShape instanceof MapShape) {
454-
throw new \InvalidArgumentException(sprintf('Headers only supports MapShape. "%s" given', $memberShape->getType()));
454+
throw new \InvalidArgumentException(\sprintf('Headers only supports MapShape. "%s" given', $memberShape->getType()));
455455
}
456456
$mapValueShape = $memberShape->getValue()->getShape();
457457
$keyValueShape = $memberShape->getKey()->getShape();
@@ -504,12 +504,12 @@ private function inputClassRequestGetters(StructureShape $inputShape, ClassBuild
504504
} else {
505505
$body['body'] = '$body = "";';
506506
if (null !== $inputShape->getPayload()) {
507-
throw new \LogicException(sprintf('Unexpected body in operation "%s"', $operation->getName()));
507+
throw new \LogicException(\sprintf('Unexpected body in operation "%s"', $operation->getName()));
508508
}
509509

510510
foreach ($inputShape->getMembers() as $member) {
511511
if (null === $member->getLocation()) {
512-
throw new \LogicException(sprintf('Unexpected body in operation "%s"', $operation->getName()));
512+
throw new \LogicException(\sprintf('Unexpected body in operation "%s"', $operation->getName()));
513513
}
514514
}
515515
}
@@ -566,7 +566,7 @@ private function inputClassRequestGetters(StructureShape $inputShape, ClassBuild
566566
private function stringify(string $variable, Member $member, string $part): string
567567
{
568568
if ('header' !== $part && 'querystring' !== $part && 'uri' !== $part) {
569-
throw new \InvalidArgumentException(sprintf('Argument 3 of "%s::%s" must be either "header" or "querystring" or "uri". Value "%s" provided', __CLASS__, __FUNCTION__, $part));
569+
throw new \InvalidArgumentException(\sprintf('Argument 3 of "%s::%s" must be either "header" or "querystring" or "uri". Value "%s" provided', __CLASS__, __FUNCTION__, $part));
570570
}
571571

572572
$shape = $member->getShape();
@@ -596,7 +596,7 @@ private function stringify(string $variable, Member $member, string $part): stri
596596
return '(string) ' . $variable;
597597
}
598598

599-
throw new \InvalidArgumentException(sprintf('Type "%s" is not yet implemented', $shape->getType()));
599+
throw new \InvalidArgumentException(\sprintf('Type "%s" is not yet implemented', $shape->getType()));
600600
}
601601

602602
/**

src/Generator/ObjectGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ private function addProperties(StructureShape $shape, ClassBuilder $classBuilder
354354
continue;
355355
}
356356

357-
throw new \LogicException(sprintf('Missing Endpoint property "%s" in "%s" object', $key, $shape->getName()));
357+
throw new \LogicException(\sprintf('Missing Endpoint property "%s" in "%s" object', $key, $shape->getName()));
358358
}
359359
}
360360
}

0 commit comments

Comments
 (0)