Skip to content

Commit 7f20c98

Browse files
chore: update api-platform to 4.0.3 (#454)
1 parent 2af5c1f commit 7f20c98

25 files changed

+296
-280
lines changed

api/composer.lock

Lines changed: 173 additions & 171 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/config/packages/api_platform.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
api_platform:
22
title: API Platform's demo
3-
version: 4.0.2
3+
version: 4.0.3
44
description: |
55
This is a demo application of the [API Platform](https://api-platform.com) framework.
66
[Its source code](https://github.com/api-platform/demo) includes various examples, check it out!

api/src/Command/BooksImportCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function __construct(
2727
private readonly SerializerInterface $serializer,
2828
private readonly DecoderInterface $decoder,
2929
private readonly HttpClientInterface $client,
30-
private readonly LoggerInterface $logger
30+
private readonly LoggerInterface $logger,
3131
) {
3232
parent::__construct();
3333
}

api/src/Doctrine/Orm/Extension/BookmarkQueryCollectionExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function applyToCollection(QueryBuilder $queryBuilder, QueryNameGenerator
3131
}
3232

3333
$queryBuilder
34-
->andWhere(sprintf('%s.user = :user', $queryBuilder->getRootAliases()[0]))
34+
->andWhere(\sprintf('%s.user = :user', $queryBuilder->getRootAliases()[0]))
3535
->setParameter('user', $user)
3636
;
3737
}

api/src/Doctrine/Orm/Filter/NameFilter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ protected function filterProperty(string $property, $value, QueryBuilder $queryB
4747
$parameterName = $queryNameGenerator->generateParameterName("name{$key}");
4848
$queryBuilder->setParameter($parameterName, "%{$value}%");
4949
$expressions[] = $queryBuilder->expr()->orX(
50-
$queryBuilder->expr()->like(sprintf('%s.firstName', $alias), ":{$parameterName}"),
51-
$queryBuilder->expr()->like(sprintf('%s.lastName', $alias), ":{$parameterName}")
50+
$queryBuilder->expr()->like(\sprintf('%s.firstName', $alias), ":{$parameterName}"),
51+
$queryBuilder->expr()->like(\sprintf('%s.lastName', $alias), ":{$parameterName}")
5252
);
5353
}
5454
$queryBuilder->andWhere($queryBuilder->expr()->andX(...$expressions));
@@ -72,7 +72,7 @@ protected function normalizeValues($value, string $property): ?array
7272

7373
if (empty($values)) {
7474
$this->getLogger()->notice('Invalid filter ignored', [
75-
'exception' => new \InvalidArgumentException(sprintf('At least one value is required, multiple values should be in "%1$s[]=firstvalue&%1$s[]=secondvalue" format', $property)),
75+
'exception' => new \InvalidArgumentException(\sprintf('At least one value is required, multiple values should be in "%1$s[]=firstvalue&%1$s[]=secondvalue" format', $property)),
7676
]);
7777

7878
return null;

api/src/Entity/User.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,6 @@ public function getName(): ?string
118118
return null;
119119
}
120120

121-
return trim(sprintf('%s %s', $this->firstName, $this->lastName));
121+
return trim(\sprintf('%s %s', $this->firstName, $this->lastName));
122122
}
123123
}

api/src/Security/Core/UserProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function refreshUser(UserInterface $user): UserInterface
2424
{
2525
$manager = $this->registry->getManagerForClass($user::class);
2626
if (!$manager) {
27-
throw new UnsupportedUserException(sprintf('User class "%s" not supported.', $user::class));
27+
throw new UnsupportedUserException(\sprintf('User class "%s" not supported.', $user::class));
2828
}
2929

3030
$manager->refresh($user);

api/src/Security/Http/AccessToken/Oidc/OidcDiscoveryTokenHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public function getUserBadgeFrom(string $accessToken): UserBadge
8787

8888
$claims = json_decode($jws->getPayload(), true);
8989
if (empty($claims[$this->claim])) {
90-
throw new MissingClaimException(sprintf('"%s" claim not found.', $this->claim));
90+
throw new MissingClaimException(\sprintf('"%s" claim not found.', $this->claim));
9191
}
9292

9393
// UserLoader argument can be overridden by a UserProvider on AccessTokenAuthenticator::authenticate

api/src/Security/Http/Protection/ResourceResourceHandler.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ public function create(object $resource, UserInterface $owner, array $context =
4141
$this->securityAuthorizationClient->request('POST', $this->getResourceRegistrationEndpoint(), [
4242
'auth_bearer' => $this->getPAT(),
4343
'json' => [
44-
'name' => sprintf('%s_%s', $shortName, $resource->getId()->__toString()),
45-
'displayName' => sprintf('%s #%s', $operation->getShortName(), $resource->getId()->__toString()),
44+
'name' => \sprintf('%s_%s', $shortName, $resource->getId()->__toString()),
45+
'displayName' => \sprintf('%s #%s', $operation->getShortName(), $resource->getId()->__toString()),
4646
'uris' => [$resourceIri],
47-
'type' => sprintf('urn:%s:resources:%s', $this->oidcClientId, $shortName),
47+
'type' => \sprintf('urn:%s:resources:%s', $this->oidcClientId, $shortName),
4848
'owner' => $owner->getUserIdentifier(),
4949
],
5050
]);
@@ -75,7 +75,7 @@ public function delete(object $resource, UserInterface $owner, array $context =
7575
'max' => 1,
7676
'uri' => $resourceIri,
7777
'owner' => $owner->getUserIdentifier(),
78-
'type' => sprintf('urn:%s:resources:%s', $this->oidcClientId, $shortName),
78+
'type' => \sprintf('urn:%s:resources:%s', $this->oidcClientId, $shortName),
7979
],
8080
]
8181
);
@@ -85,7 +85,7 @@ public function delete(object $resource, UserInterface $owner, array $context =
8585
// delete corresponding resource_set on OIDC server
8686
$this->securityAuthorizationClient->request(
8787
'DELETE',
88-
sprintf('%s/%s', $this->getResourceRegistrationEndpoint(), $resourceSet['_id']),
88+
\sprintf('%s/%s', $this->getResourceRegistrationEndpoint(), $resourceSet['_id']),
8989
[
9090
'auth_bearer' => $this->getPAT(),
9191
]

api/src/Security/Voter/OidcRoleVoter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ protected function supports(string $attribute, mixed $subject): bool
3636
protected function voteOnAttribute(string $attribute, mixed $subject, TokenInterface $token): bool
3737
{
3838
if (!empty($subject)) {
39-
throw new \InvalidArgumentException(sprintf('Invalid subject type, expected empty string or "null", got "%s".', get_debug_type($subject)));
39+
throw new \InvalidArgumentException(\sprintf('Invalid subject type, expected empty string or "null", got "%s".', get_debug_type($subject)));
4040
}
4141

4242
// ensure user is authenticated

0 commit comments

Comments
 (0)