Skip to content

Commit 80cfca6

Browse files
committed
Upgrade cs-fixer fixes
1 parent e8bf438 commit 80cfca6

File tree

80 files changed

+216
-216
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+216
-216
lines changed

features/bootstrap/DoctrineContext.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -422,8 +422,8 @@ public function thereAreRoutes(int $count): void
422422
for ($x = 0; $x < $count; ++$x) {
423423
$route = new Route();
424424
$route
425-
->setPath(sprintf('/route-%s', $x))
426-
->setName(sprintf('/route-%s', $x));
425+
->setPath(\sprintf('/route-%s', $x))
426+
->setName(\sprintf('/route-%s', $x));
427427
$this->timestampedHelper->persistTimestampedFields($route, true);
428428
$this->manager->persist($route);
429429
$this->restContext->resources['route_' . $x] = $this->iriConverter->getIriFromResource($route);
@@ -602,7 +602,7 @@ public function iPatchPageDataWithThePropertyAndResource(string $property, strin
602602
'PUT',
603603
'page_data',
604604
null,
605-
new PyStringNode([sprintf('{ "%s": "%s" }', $property, $iri)], 0)
605+
new PyStringNode([\sprintf('{ "%s": "%s" }', $property, $iri)], 0)
606606
);
607607
}
608608

@@ -767,7 +767,7 @@ public function theIsAComponentInARouteWithPath(string $resource, string $path):
767767
{
768768
$component = $this->iriConverter->getResourceFromIri($this->restContext->resources[$resource]);
769769
if (!$component instanceof AbstractComponent) {
770-
throw new \RuntimeException(sprintf('The resource named `%s` is not a component', $resource));
770+
throw new \RuntimeException(\sprintf('The resource named `%s` is not a component', $resource));
771771
}
772772

773773
$page = $this->thereIsAPage('page_1');
@@ -870,7 +870,7 @@ public function theResourceShouldNotExist(string $name): void
870870
try {
871871
$iri = $this->restContext->resources[$name];
872872
$this->iriConverter->getResourceFromIri($iri);
873-
throw new ExpectationException(sprintf('The resource %s can still be found and has not been removed', $iri), $this->minkContext->getSession()->getDriver());
873+
throw new ExpectationException(\sprintf('The resource %s can still be found and has not been removed', $iri), $this->minkContext->getSession()->getDriver());
874874
} catch (ItemNotFoundException $exception) {
875875
}
876876
}
@@ -886,7 +886,7 @@ public function theRefreshTokenShouldBeExpired(): void
886886
'user' => $this->iriConverter->getResourceFromIri($this->restContext->resources['login_user']),
887887
]);
888888
if (!$token->isExpired()) {
889-
throw new ExpectationException(sprintf('The token with ID %s is not expired', $this->restContext->resources['refresh_token']), $this->minkContext->getSession()->getDriver());
889+
throw new ExpectationException(\sprintf('The token with ID %s is not expired', $this->restContext->resources['refresh_token']), $this->minkContext->getSession()->getDriver());
890890
}
891891
}
892892

@@ -902,7 +902,7 @@ public function allTheRefreshTokensShouldBeExpired(): void
902902
]);
903903
foreach ($tokens as $token) {
904904
if (!$token->isExpired()) {
905-
throw new ExpectationException(sprintf('The token with ID %s is not expired', $this->restContext->resources['refresh_token']), $this->minkContext->getSession()->getDriver());
905+
throw new ExpectationException(\sprintf('The token with ID %s is not expired', $this->restContext->resources['refresh_token']), $this->minkContext->getSession()->getDriver());
906906
}
907907
}
908908
}
@@ -917,7 +917,7 @@ public function theResourceShouldExist(string $name): void
917917
$iri = $this->restContext->resources[$name];
918918
$this->iriConverter->getResourceFromIri($iri);
919919
} catch (ItemNotFoundException $exception) {
920-
throw new ExpectationException(sprintf('The resource %s cannot be found anymore', $iri), $this->minkContext->getSession()->getDriver());
920+
throw new ExpectationException(\sprintf('The resource %s cannot be found anymore', $iri), $this->minkContext->getSession()->getDriver());
921921
}
922922
}
923923

@@ -1014,6 +1014,6 @@ public function aRefreshTokenShouldHaveBeenGenerated(int $count): void
10141014
++$nonExpiredCount;
10151015
}
10161016
}
1017-
Assert::assertLessThanOrEqual(1, $nonExpiredCount, sprintf('There should only be 1 token that is not expired. There are %d', $nonExpiredCount));
1017+
Assert::assertLessThanOrEqual(1, $nonExpiredCount, \sprintf('There should only be 1 token that is not expired. There are %d', $nonExpiredCount));
10181018
}
10191019
}

features/bootstrap/JsonContext.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ private function getCookieByName(string $name): Cookie
200200
return $cookie;
201201
}
202202
}
203-
throw new \Exception(sprintf('The cookie "%s" was not found in the response headers.', $name));
203+
throw new \Exception(\sprintf('The cookie "%s" was not found in the response headers.', $name));
204204
}
205205

206206
/**
@@ -210,7 +210,7 @@ public function theResponseShouldHaveACookieWithMaxAgeLessThan(string $name, int
210210
{
211211
$cookie = $this->getCookieByName($name);
212212
$timeDiff = $cookie->getExpiresTime() - time();
213-
Assert::assertLessThan($seconds, $timeDiff, sprintf('The cookie "%s" expires in "%d" seconds. Expected less than "%d" seconds', $name, $timeDiff, $seconds));
213+
Assert::assertLessThan($seconds, $timeDiff, \sprintf('The cookie "%s" expires in "%d" seconds. Expected less than "%d" seconds', $name, $timeDiff, $seconds));
214214
}
215215

216216
/**
@@ -220,7 +220,7 @@ public function theResponseShouldHaveACookieWithTheValue(string $name, ?string $
220220
{
221221
$cookie = $this->getCookieByName($name);
222222
$real = $cookie->getValue();
223-
Assert::assertEquals($value, $real, sprintf('The cookie "%s" has the value "%s". Expected "%s"', $name, $real, $value));
223+
Assert::assertEquals($value, $real, \sprintf('The cookie "%s" has the value "%s". Expected "%s"', $name, $real, $value));
224224
}
225225

226226
/**
@@ -234,7 +234,7 @@ public function theJsonNodeShouldBeEqualTo($node): void
234234
$actual = $this->inspector->evaluate($json, $node);
235235
$diff = (new \DateTime($text))->getTimestamp() - (new \DateTime($actual))->getTimestamp();
236236
if ($diff < -1 || $diff > 1) {
237-
throw new \Exception(sprintf("The node value is '%s' which is a difference of %s seconds to the cached 'now' value", json_encode($actual), $diff));
237+
throw new \Exception(\sprintf("The node value is '%s' which is a difference of %s seconds to the cached 'now' value", json_encode($actual), $diff));
238238
}
239239
}
240240

@@ -268,7 +268,7 @@ public function theJsonNodeShouldMatchTheRegex(string $name, string $expression)
268268
$actual = $this->inspector->evaluate($json, $name);
269269

270270
if (1 !== preg_match($expression, $actual)) {
271-
throw new \Exception(sprintf("The node value did not match '%s'. It is '%s'", $expression, json_encode($actual)));
271+
throw new \Exception(\sprintf("The node value did not match '%s'. It is '%s'", $expression, json_encode($actual)));
272272
}
273273
}
274274

features/bootstrap/ProfilerContext.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function thereShouldBeAPublishedMercureUpdatePublished(?int $count = null
8888
{
8989
$messageObjects = $this->getMercureMessageObjects();
9090
if (null !== $count && \count($messageObjects) !== $count) {
91-
throw new ExpectationException(sprintf('%d updates were published but %d were expected', \count($messageObjects), $count), $this->minkContext->getSession()->getDriver());
91+
throw new ExpectationException(\sprintf('%d updates were published but %d were expected', \count($messageObjects), $count), $this->minkContext->getSession()->getDriver());
9292
}
9393

9494
return $messageObjects;
@@ -117,7 +117,7 @@ private function getMercureComponentGroupMessage()
117117
return $messageAsArray;
118118
}
119119
}
120-
throw new ExpectationException(sprintf('%d updates were published but no ComponentGroup was found', \count($messageObjects)), $this->minkContext->getSession()->getDriver());
120+
throw new ExpectationException(\sprintf('%d updates were published but no ComponentGroup was found', \count($messageObjects)), $this->minkContext->getSession()->getDriver());
121121
}
122122

123123
/**
@@ -156,7 +156,7 @@ public function thereShouldMercureMessagesForDraftResources(int $count)
156156
}
157157
}
158158
if ($draftCount !== $count) {
159-
throw new ExpectationException(sprintf('%d draft updates were published but %d were expected', $draftCount, $count), $this->minkContext->getSession()->getDriver());
159+
throw new ExpectationException(\sprintf('%d draft updates were published but %d were expected', $draftCount, $count), $this->minkContext->getSession()->getDriver());
160160
}
161161
}
162162

@@ -184,7 +184,7 @@ public function theResourceShouldBePurgedFromTheCache(string $resourceName)
184184
}
185185
}
186186
}
187-
throw new ExpectationException(sprintf('The resource %s was not found in any xkey headers sent to be purged. IRIs that were purged were `%s`', $expectedIri, implode('`, `', $purged)), $this->minkContext->getSession()->getDriver());
187+
throw new ExpectationException(\sprintf('The resource %s was not found in any xkey headers sent to be purged. IRIs that were purged were `%s`', $expectedIri, implode('`, `', $purged)), $this->minkContext->getSession()->getDriver());
188188
}
189189

190190
/**
@@ -213,7 +213,7 @@ public function iShouldGetAnEmail(string $emailType, string $emailAddress = 'use
213213
return $email->getSubject();
214214
}, $messages);
215215

216-
Assert::assertCount(1, $messages, sprintf("%d messages were sent but only 1 was expected. Messages were sent with subjects '%s'", \count($messages), implode("', '", $subjects)));
216+
Assert::assertCount(1, $messages, \sprintf("%d messages were sent but only 1 was expected. Messages were sent with subjects '%s'", \count($messages), implode("', '", $subjects)));
217217
Assert::assertInstanceOf(TemplatedEmail::class, $email = $messages[0]);
218218

219219
/** @var TemplatedEmail $email */
@@ -260,7 +260,7 @@ public function iShouldGetAnEmail(string $emailType, string $emailAddress = 'use
260260
$this->validatePasswordChanged($headers);
261261
break;
262262
default:
263-
throw new \InvalidArgumentException(sprintf('The email type %s is not configured to test', $emailType));
263+
throw new \InvalidArgumentException(\sprintf('The email type %s is not configured to test', $emailType));
264264
}
265265
}
266266

features/bootstrap/PublishableContext.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public function thereIsADraftFor(string $publishedComponent, ?string $publishDat
123123
{
124124
$component = $this->iriConverter->getResourceFromIri($this->restContext->resources[$publishedComponent]);
125125
if (!$component instanceof DummyPublishableComponent) {
126-
throw new \RuntimeException(sprintf('The resource named `%s` is not a DummyPublishableComponent', $publishedComponent));
126+
throw new \RuntimeException(\sprintf('The resource named `%s` is not a DummyPublishableComponent', $publishedComponent));
127127
}
128128
$publishAt = $publishDate ? (new \DateTime($publishDate))->format('Y-m-d H:i:s') : null;
129129
$draft = $this->thereIsAPublishableResource($publishAt, false, true);
@@ -222,7 +222,7 @@ public function thereIsACustomPublishableResource(?string $publishDate = null, b
222222
$flush && $this->manager->flush();
223223

224224
$this->resources[] = $resource;
225-
$componentKey = sprintf('publishable_%s', $isPublished ? 'published' : 'draft');
225+
$componentKey = \sprintf('publishable_%s', $isPublished ? 'published' : 'draft');
226226
$this->restContext->resources[$componentKey] = $this->iriConverter->getIriFromResource($resource);
227227

228228
return $resource;
@@ -262,7 +262,7 @@ static function (DummyPublishableComponent $component) {
262262
$expectedTotal = \count($draftResources) + \count($this->publishedResourcesWithoutDrafts);
263263

264264
if ($expectedTotal !== ($receivedTotal = \count($items))) {
265-
throw new ExpectationException(sprintf('Expected %d resources but received %d', $expectedTotal, $receivedTotal), $this->minkContext->getSession()->getDriver());
265+
throw new ExpectationException(\sprintf('Expected %d resources but received %d', $expectedTotal, $receivedTotal), $this->minkContext->getSession()->getDriver());
266266
}
267267

268268
$expectedPublishedResourceIds = $this->getResourceIds($this->publishedResourcesWithoutDrafts);
@@ -293,7 +293,7 @@ static function (DummyPublishableComponent $component) {
293293

294294
$expectedTotal = \count($publishedResources);
295295

296-
Assert::assertEquals($expectedTotal, $receivedTotal = \count($items), sprintf('Expected %d resources but received %d', $expectedTotal, $receivedTotal));
296+
Assert::assertEquals($expectedTotal, $receivedTotal = \count($items), \sprintf('Expected %d resources but received %d', $expectedTotal, $receivedTotal));
297297

298298
foreach ($items as $item) {
299299
Assert::assertEquals('is_published', $item['reference'], 'Received an unexpected item in the response: ' . json_encode($item, \JSON_THROW_ON_ERROR, 512));
@@ -319,7 +319,7 @@ public function theResponseShouldIncludeThePublishedResourcesOnlyWithoutTheDraft
319319
public function theComponentPositionShouldHaveTheComponent(string $reference)
320320
{
321321
$response = $this->jsonContext->getJsonAsArray();
322-
Assert::assertEquals($this->restContext->resources[$reference], $response['component'], sprintf('The component position was expected to have the component %s but %s was returned', $this->restContext->resources[$reference], $response['component']));
322+
Assert::assertEquals($this->restContext->resources[$reference], $response['component'], \sprintf('The component position was expected to have the component %s but %s was returned', $this->restContext->resources[$reference], $response['component']));
323323
}
324324

325325
/**
@@ -334,7 +334,7 @@ private function createPublishableComponent(?\DateTime $publishedAt, bool $force
334334
$this->manager->persist($resource);
335335
$this->resources[] = $resource;
336336

337-
$componentKey = sprintf('publishable_%s', $isPublished ? 'published' : 'draft');
337+
$componentKey = \sprintf('publishable_%s', $isPublished ? 'published' : 'draft');
338338
$this->restContext->resources[$componentKey] = $this->iriConverter->getIriFromResource($resource);
339339

340340
return $resource;

features/bootstrap/RestContext.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public function iSendARequestToWithData($method, $url, TableNode $tableNode): vo
151151
public function iAddHeaderEqualToTheResource($name, $resource)
152152
{
153153
if (!isset($this->resources[$resource])) {
154-
throw new ExpectationException(sprintf("The resource with name $resource has not been defined. (Components that exist are `%s`)", implode('`, `', array_keys($this->resources))), $this->minkContext->getSession()->getDriver());
154+
throw new ExpectationException(\sprintf("The resource with name $resource has not been defined. (Components that exist are `%s`)", implode('`, `', array_keys($this->resources))), $this->minkContext->getSession()->getDriver());
155155
}
156156
$value = $this->resources[$resource];
157157
$this->restContext->iAddHeaderEqualTo($name, $value);
@@ -163,7 +163,7 @@ public function iAddHeaderEqualToTheResource($name, $resource)
163163
public function iSendARequestToTheResourceWithBody(string $method, string $resource, ?string $postfix = null, ?PyStringNode $body = null)
164164
{
165165
if (!isset($this->resources[$resource])) {
166-
throw new ExpectationException(sprintf("The resource with name $resource has not been defined. (Components that exist are `%s`)", implode('`, `', array_keys($this->resources))), $this->minkContext->getSession()->getDriver());
166+
throw new ExpectationException(\sprintf("The resource with name $resource has not been defined. (Components that exist are `%s`)", implode('`, `', array_keys($this->resources))), $this->minkContext->getSession()->getDriver());
167167
}
168168
$endpoint = $this->resources[$resource] . ($postfix ?: '');
169169

features/bootstrap/UploadsContext.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ private function getUploadableResourceByName(string $name)
176176
/* @var UploadableTrait $item */
177177
return $this->iriConverter->getResourceFromIri($iri);
178178
} catch (ItemNotFoundException $exception) {
179-
throw new ExpectationException(sprintf('The resource %s cannot be found anymore', $iri), $this->minkContext->getSession()->getDriver());
179+
throw new ExpectationException(\sprintf('The resource %s cannot be found anymore', $iri), $this->minkContext->getSession()->getDriver());
180180
}
181181
}
182182
}

src/Action/Uploadable/DownloadAction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class DownloadAction
2626
public function __invoke(object $data, string $property, Request $request, UploadableAttributeReader $annotationReader, UploadableFileManager $uploadableFileManager)
2727
{
2828
if (!$annotationReader->isConfigured($data)) {
29-
throw new InvalidArgumentException(sprintf('%s is not an uploadable resource. It should not be configured to use %s.', $data::class, __CLASS__));
29+
throw new InvalidArgumentException(\sprintf('%s is not an uploadable resource. It should not be configured to use %s.', $data::class, __CLASS__));
3030
}
3131

3232
return $uploadableFileManager->getFileResponse($data, $property, $request->query->getBoolean('download', false));

src/Action/Uploadable/UploadAction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __invoke(?object $data, Request $request, UploadableFileManager
4242
$contentType = explode(';', $contentType)[0];
4343
$formats = ['multipart/form-data'];
4444
if (!\in_array(strtolower($contentType), $formats, true)) {
45-
throw new UnsupportedMediaTypeHttpException(sprintf('The content-type "%s" is not supported. Supported MIME type is "%s".', $contentType, implode('", "', $formats)));
45+
throw new UnsupportedMediaTypeHttpException(\sprintf('The content-type "%s" is not supported. Supported MIME type is "%s".', $contentType, implode('", "', $formats)));
4646
}
4747

4848
$resourceClass = $request->attributes->get('_api_resource_class');

src/ApiPlatform/Metadata/Resource/ComponentResourceMetadataFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ public function create(string $resourceClass): ResourceMetadataCollection
4848
foreach ($resourceMetadata as $resourceMetadatum) {
4949
$resourceShortName = $resourceMetadatum->getShortName();
5050
if (!$resourceShortName) {
51-
throw new \RuntimeException(sprintf('Could not find short name from resource metadata for %s', $resourceClass));
51+
throw new \RuntimeException(\sprintf('Could not find short name from resource metadata for %s', $resourceClass));
5252
}
5353

5454
$pathSegmentName = $this->pathSegmentNameGenerator->getSegmentName($resourceShortName);
55-
$usagePath = sprintf('/%s/{id}/usage', $pathSegmentName);
55+
$usagePath = \sprintf('/%s/{id}/usage', $pathSegmentName);
5656

5757
$operations = $resourceMetadatum->getOperations();
5858
if ($operations) {

src/ApiPlatform/Metadata/Resource/RoutableResourceMetadataCollectionFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function create(string $resourceClass): ResourceMetadataCollection
5656
HttpOperation::METHOD_POST !== $operation->getMethod()
5757
&& !$operation instanceof CollectionOperationInterface
5858
&& !$operation->getSecurity()) {
59-
$operation = $operation->withSecurity(sprintf("is_granted('%s', object)", AbstractRoutableVoter::READ_ROUTABLE));
59+
$operation = $operation->withSecurity(\sprintf("is_granted('%s', object)", AbstractRoutableVoter::READ_ROUTABLE));
6060
}
6161
$newOperations[$i] = $operation;
6262
}

0 commit comments

Comments
 (0)