Skip to content

Commit ec2c2d3

Browse files
committed
Fix CS
1 parent 01ebde6 commit ec2c2d3

21 files changed

+51
-51
lines changed

src/Command/ClearExpiredTokensCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
103103
private function clearExpiredAccessTokens(SymfonyStyle $io): void
104104
{
105105
$numOfClearedAccessTokens = $this->accessTokenManager->clearExpired();
106-
$io->success(sprintf(
106+
$io->success(\sprintf(
107107
'Cleared %d expired access token%s.',
108108
$numOfClearedAccessTokens,
109109
1 === $numOfClearedAccessTokens ? '' : 's'
@@ -113,7 +113,7 @@ private function clearExpiredAccessTokens(SymfonyStyle $io): void
113113
private function clearExpiredRefreshTokens(SymfonyStyle $io): void
114114
{
115115
$numOfClearedRefreshTokens = $this->refreshTokenManager->clearExpired();
116-
$io->success(sprintf(
116+
$io->success(\sprintf(
117117
'Cleared %d expired refresh token%s.',
118118
$numOfClearedRefreshTokens,
119119
1 === $numOfClearedRefreshTokens ? '' : 's'
@@ -123,7 +123,7 @@ private function clearExpiredRefreshTokens(SymfonyStyle $io): void
123123
private function clearExpiredAuthCodes(SymfonyStyle $io): void
124124
{
125125
$numOfClearedAuthCodes = $this->authorizationCodeManager->clearExpired();
126-
$io->success(sprintf(
126+
$io->success(\sprintf(
127127
'Cleared %d expired auth code%s.',
128128
$numOfClearedAuthCodes,
129129
1 === $numOfClearedAuthCodes ? '' : 's'

src/Command/DeleteClientCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
4444
$io = new SymfonyStyle($input, $output);
4545

4646
if (null === $client = $this->clientManager->find($input->getArgument('identifier'))) {
47-
$io->error(sprintf('OAuth2 client identified as "%s" does not exist.', $input->getArgument('identifier')));
47+
$io->error(\sprintf('OAuth2 client identified as "%s" does not exist.', $input->getArgument('identifier')));
4848

4949
return 1;
5050
}

src/Command/GenerateKeyPairCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
6868
$io = new SymfonyStyle($input, $output);
6969

7070
if (!\in_array($this->algorithm, self::ACCEPTED_ALGORITHMS, true)) {
71-
$io->error(sprintf('Cannot generate key pair with the provided algorithm `%s`.', $this->algorithm));
71+
$io->error(\sprintf('Cannot generate key pair with the provided algorithm `%s`.', $this->algorithm));
7272

7373
return Command::FAILURE;
7474
}
@@ -78,10 +78,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int
7878
if ($input->getOption('dry-run')) {
7979
$io->success('Your keys have been generated!');
8080
$io->newLine();
81-
$io->writeln(sprintf('Update your private key in <info>%s</info>:', $this->secretKey));
81+
$io->writeln(\sprintf('Update your private key in <info>%s</info>:', $this->secretKey));
8282
$io->writeln($secretKey);
8383
$io->newLine();
84-
$io->writeln(sprintf('Update your public key in <info>%s</info>:', $this->publicKey));
84+
$io->writeln(\sprintf('Update your public key in <info>%s</info>:', $this->publicKey));
8585
$io->writeln($publicKey);
8686

8787
return Command::SUCCESS;

src/Command/UpdateClientCommand.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
5757
$io = new SymfonyStyle($input, $output);
5858

5959
if (null === $client = $this->clientManager->find($input->getArgument('identifier'))) {
60-
$io->error(sprintf('OAuth2 client identified as "%s" does not exist.', $input->getArgument('identifier')));
60+
$io->error(\sprintf('OAuth2 client identified as "%s" does not exist.', $input->getArgument('identifier')));
6161

6262
return 1;
6363
}
@@ -107,13 +107,13 @@ private function getClientActiveFromInput(InputInterface $input, bool $actual):
107107
private function getClientRelatedModelsFromInput(InputInterface $input, string $modelFqcn, array $actual, string $argument): array
108108
{
109109
/** @var list<string> $toAdd */
110-
$toAdd = $input->getOption($addArgument = sprintf('add-%s', $argument));
110+
$toAdd = $input->getOption($addArgument = \sprintf('add-%s', $argument));
111111

112112
/** @var list<string> $toRemove */
113-
$toRemove = $input->getOption($removeArgument = sprintf('remove-%s', $argument));
113+
$toRemove = $input->getOption($removeArgument = \sprintf('remove-%s', $argument));
114114

115115
if ([] !== $colliding = array_intersect($toAdd, $toRemove)) {
116-
throw new \RuntimeException(sprintf('Cannot specify "%s" in either "--%s" and "--%s".', implode('", "', $colliding), $addArgument, $removeArgument));
116+
throw new \RuntimeException(\sprintf('Cannot specify "%s" in either "--%s" and "--%s".', implode('", "', $colliding), $addArgument, $removeArgument));
117117
}
118118

119119
$filtered = array_filter($actual, static function ($model) use ($toRemove): bool {

src/DBAL/Type/ImplodedArray.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ private function assertValueCanBeImploded($value): void
8383
return;
8484
}
8585

86-
throw new \InvalidArgumentException(sprintf('The value of \'%s\' type cannot be imploded.', \gettype($value)));
86+
throw new \InvalidArgumentException(\sprintf('The value of \'%s\' type cannot be imploded.', \gettype($value)));
8787
}
8888

8989
/**

src/DependencyInjection/CompilerPass/EncryptionKeyPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@ public function process(ContainerBuilder $container): void
4444
return;
4545
}
4646

47-
throw new \RuntimeException(sprintf('The value "%s" is not allowed for path "league_oauth2_server.authorization_server.encryption_key_type". Permissible values: "plain", "defuse"', $encryptionKeyType));
47+
throw new \RuntimeException(\sprintf('The value "%s" is not allowed for path "league_oauth2_server.authorization_server.encryption_key_type". Permissible values: "plain", "defuse"', $encryptionKeyType));
4848
}
4949
}

src/DependencyInjection/Configuration.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ private function createAuthorizationServerNode(): NodeDefinition
5555
->defaultValue(null)
5656
->end()
5757
->scalarNode('encryption_key')
58-
->info(sprintf("The plain string or the ascii safe string used to create a %s to be used as an encryption key.\nHow to generate an encryption key: https://oauth2.thephpleague.com/installation/#string-password", Key::class))
58+
->info(\sprintf("The plain string or the ascii safe string used to create a %s to be used as an encryption key.\nHow to generate an encryption key: https://oauth2.thephpleague.com/installation/#string-password", Key::class))
5959
->isRequired()
6060
->cannotBeEmpty()
6161
->end()
@@ -240,13 +240,13 @@ private function createClientNode(): NodeDefinition
240240
->addDefaultsIfNotSet()
241241
->children()
242242
->scalarNode('classname')
243-
->info(sprintf('Set a custom client class. Must be a %s', AbstractClient::class))
243+
->info(\sprintf('Set a custom client class. Must be a %s', AbstractClient::class))
244244
->defaultValue(Client::class)
245245
->validate()
246246
->ifTrue(function ($v) {
247247
return !is_a($v, AbstractClient::class, true);
248248
})
249-
->thenInvalid(sprintf('%%s must be a %s', AbstractClient::class))
249+
->thenInvalid(\sprintf('%%s must be a %s', AbstractClient::class))
250250
->end()
251251
->end()
252252
->end()

src/DependencyInjection/LeagueOAuth2ServerExtension.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ private function assertRequiredBundlesAreEnabled(ContainerBuilder $container): v
126126

127127
foreach ($requiredBundles as $bundleAlias => $requiredBundle) {
128128
if (!$container->hasExtension($bundleAlias)) {
129-
throw new \LogicException(sprintf('Bundle \'%s\' needs to be enabled in your application kernel.', $requiredBundle));
129+
throw new \LogicException(\sprintf('Bundle \'%s\' needs to be enabled in your application kernel.', $requiredBundle));
130130
}
131131
}
132132
}
@@ -260,7 +260,7 @@ private function configureDoctrinePersistence(ContainerBuilder $container, array
260260
$entityManagerName = $persistenceConfig['entity_manager'];
261261

262262
$entityManager = new Reference(
263-
sprintf('doctrine.orm.%s_entity_manager', $entityManagerName)
263+
\sprintf('doctrine.orm.%s_entity_manager', $entityManagerName)
264264
);
265265

266266
$container
@@ -339,7 +339,7 @@ private function configureScopes(ContainerBuilder $container, array $scopes): vo
339339
$defaultScopes = $scopes['default'];
340340

341341
if ([] !== $invalidDefaultScopes = array_diff($defaultScopes, $availableScopes)) {
342-
throw new \LogicException(sprintf('Invalid default scopes "%s" for path "league_oauth2_server.scopes.default". Permissible values: "%s"', implode('", "', $invalidDefaultScopes), implode('", "', $availableScopes)));
342+
throw new \LogicException(\sprintf('Invalid default scopes "%s" for path "league_oauth2_server.scopes.default". Permissible values: "%s"', implode('", "', $invalidDefaultScopes), implode('", "', $availableScopes)));
343343
}
344344

345345
$container->setParameter('league.oauth2_server.scopes.default', $defaultScopes);

src/DependencyInjection/Security/OAuth2FactoryTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function create(ContainerBuilder $container, $id, $config, $userProvider,
2323

2424
public function createAuthenticator(ContainerBuilder $container, string $firewallName, array $config, string $userProviderId): string
2525
{
26-
$authenticator = sprintf('security.authenticator.oauth2.%s', $firewallName);
26+
$authenticator = \sprintf('security.authenticator.oauth2.%s', $firewallName);
2727

2828
$definition = new ChildDefinition(OAuth2Authenticator::class);
2929
$definition->replaceArgument(2, new Reference($userProviderId));

src/Event/AuthorizationRequestResolveEventFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function fromAuthorizationRequest(AuthorizationRequest $authorizationRequ
3333
$client = $this->clientManager->find($authorizationRequest->getClient()->getIdentifier());
3434

3535
if (null === $client) {
36-
throw new \RuntimeException(sprintf('No client found for the given identifier \'%s\'.', $authorizationRequest->getClient()->getIdentifier()));
36+
throw new \RuntimeException(\sprintf('No client found for the given identifier \'%s\'.', $authorizationRequest->getClient()->getIdentifier()));
3737
}
3838

3939
return new AuthorizationRequestResolveEvent($authorizationRequest, $scopes, $client);

src/Persistence/Mapping/Driver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function loadMetadataForClass($className, ClassMetadata $metadata): void
6262

6363
break;
6464
default:
65-
throw new \RuntimeException(sprintf('%s cannot load metadata for class %s', __CLASS__, $className));
65+
throw new \RuntimeException(\sprintf('%s cannot load metadata for class %s', __CLASS__, $className));
6666
}
6767
}
6868

src/Security/Authentication/Token/OAuth2Token.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function __construct(
2828

2929
// Build roles from scope
3030
$roles = array_map(function (string $scope) use ($rolePrefix): string {
31-
return strtoupper(trim(sprintf('%s%s', $rolePrefix, $scope)));
31+
return strtoupper(trim(\sprintf('%s%s', $rolePrefix, $scope)));
3232
}, $scopes);
3333

3434
if (null !== $user) {

src/Security/Authenticator/OAuth2Authenticator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public function doAuthenticate(Request $request) /* : Passport */
123123
public function createAuthenticatedToken(PassportInterface $passport, string $firewallName): TokenInterface
124124
{
125125
if (!$passport instanceof Passport) {
126-
throw new \RuntimeException(sprintf('Cannot create a OAuth2 authenticated token. $passport should be a %s', Passport::class));
126+
throw new \RuntimeException(\sprintf('Cannot create a OAuth2 authenticated token. $passport should be a %s', Passport::class));
127127
}
128128

129129
$token = $this->createToken($passport, $firewallName);

src/ValueObject/RedirectUri.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class RedirectUri
2020
public function __construct(string $redirectUri)
2121
{
2222
if (!filter_var($redirectUri, \FILTER_VALIDATE_URL)) {
23-
throw new \RuntimeException(sprintf('The \'%s\' string is not a valid URI.', $redirectUri));
23+
throw new \RuntimeException(\sprintf('The \'%s\' string is not a valid URI.', $redirectUri));
2424
}
2525

2626
$this->redirectUri = $redirectUri;

tests/Acceptance/DeleteClientCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function testDeleteNonExistentClient(): void
4242
'identifier' => $identifierName,
4343
]);
4444
$output = $commandTester->getDisplay();
45-
$this->assertStringContainsString(sprintf('OAuth2 client identified as "%s" does not exist.', $identifierName), $output);
45+
$this->assertStringContainsString(\sprintf('OAuth2 client identified as "%s" does not exist.', $identifierName), $output);
4646
}
4747

4848
private function findClient(string $identifier): ?Client

tests/Acceptance/SecurityLayerTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function testAuthenticatedGuestRequest(): void
3535
->find(FixtureFactory::FIXTURE_ACCESS_TOKEN_PUBLIC);
3636

3737
$this->client->request('GET', '/security-test', [], [], [
38-
'HTTP_AUTHORIZATION' => sprintf('Bearer %s', TestHelper::generateJwtToken($accessToken)),
38+
'HTTP_AUTHORIZATION' => \sprintf('Bearer %s', TestHelper::generateJwtToken($accessToken)),
3939
]);
4040

4141
$response = $this->client->getResponse();
@@ -52,7 +52,7 @@ public function testAuthenticatedGuestScopedRequest(): void
5252
->find(FixtureFactory::FIXTURE_ACCESS_TOKEN_WITH_SCOPES);
5353

5454
$this->client->request('GET', '/security-test-scopes', [], [], [
55-
'HTTP_AUTHORIZATION' => sprintf('Bearer %s', TestHelper::generateJwtToken($accessToken)),
55+
'HTTP_AUTHORIZATION' => \sprintf('Bearer %s', TestHelper::generateJwtToken($accessToken)),
5656
]);
5757

5858
$response = $this->client->getResponse();
@@ -69,7 +69,7 @@ public function testAuthenticatedUserRequest(): void
6969
->find(FixtureFactory::FIXTURE_ACCESS_TOKEN_USER_BOUND);
7070

7171
$this->client->request('GET', '/security-test', [], [], [
72-
'HTTP_AUTHORIZATION' => sprintf('Bearer %s', TestHelper::generateJwtToken($accessToken)),
72+
'HTTP_AUTHORIZATION' => \sprintf('Bearer %s', TestHelper::generateJwtToken($accessToken)),
7373
]);
7474

7575
$response = $this->client->getResponse();
@@ -86,7 +86,7 @@ public function testAuthenticatedUserRolesRequest(): void
8686
->find(FixtureFactory::FIXTURE_ACCESS_TOKEN_USER_BOUND_WITH_SCOPES);
8787

8888
$this->client->request('GET', '/security-test-roles', [], [], [
89-
'HTTP_AUTHORIZATION' => sprintf('Bearer %s', TestHelper::generateJwtToken($accessToken)),
89+
'HTTP_AUTHORIZATION' => \sprintf('Bearer %s', TestHelper::generateJwtToken($accessToken)),
9090
]);
9191

9292
$response = $this->client->getResponse();
@@ -103,7 +103,7 @@ public function testSuccessfulAuthorizationForAuthenticatedUserRequest(): void
103103
->find(FixtureFactory::FIXTURE_ACCESS_TOKEN_USER_BOUND_WITH_SCOPES);
104104

105105
$this->client->request('GET', '/security-test-authorization', [], [], [
106-
'HTTP_AUTHORIZATION' => sprintf('Bearer %s', TestHelper::generateJwtToken($accessToken)),
106+
'HTTP_AUTHORIZATION' => \sprintf('Bearer %s', TestHelper::generateJwtToken($accessToken)),
107107
]);
108108

109109
$response = $this->client->getResponse();
@@ -120,7 +120,7 @@ public function testUnsuccessfulAuthorizationForAuthenticatedUserRequest(): void
120120
->find(FixtureFactory::FIXTURE_ACCESS_TOKEN_USER_BOUND);
121121

122122
$this->client->request('GET', '/security-test-authorization', [], [], [
123-
'HTTP_AUTHORIZATION' => sprintf('Bearer %s', TestHelper::generateJwtToken($accessToken)),
123+
'HTTP_AUTHORIZATION' => \sprintf('Bearer %s', TestHelper::generateJwtToken($accessToken)),
124124
]);
125125

126126
$response = $this->client->getResponse();
@@ -137,7 +137,7 @@ public function testExpiredRequest(): void
137137
->find(FixtureFactory::FIXTURE_ACCESS_TOKEN_EXPIRED);
138138

139139
$this->client->request('GET', '/security-test', [], [], [
140-
'HTTP_AUTHORIZATION' => sprintf('Bearer %s', TestHelper::generateJwtToken($accessToken)),
140+
'HTTP_AUTHORIZATION' => \sprintf('Bearer %s', TestHelper::generateJwtToken($accessToken)),
141141
]);
142142

143143
$response = $this->client->getResponse();
@@ -153,7 +153,7 @@ public function testRevokedRequest(): void
153153
->find(FixtureFactory::FIXTURE_ACCESS_TOKEN_REVOKED);
154154

155155
$this->client->request('GET', '/security-test', [], [], [
156-
'HTTP_AUTHORIZATION' => sprintf('Bearer %s', TestHelper::generateJwtToken($accessToken)),
156+
'HTTP_AUTHORIZATION' => \sprintf('Bearer %s', TestHelper::generateJwtToken($accessToken)),
157157
]);
158158

159159
$response = $this->client->getResponse();
@@ -169,7 +169,7 @@ public function testInsufficientScopeRequest(): void
169169
->find(FixtureFactory::FIXTURE_ACCESS_TOKEN_PUBLIC);
170170

171171
$this->client->request('GET', '/security-test-scopes', [], [], [
172-
'HTTP_AUTHORIZATION' => sprintf('Bearer %s', TestHelper::generateJwtToken($accessToken)),
172+
'HTTP_AUTHORIZATION' => \sprintf('Bearer %s', TestHelper::generateJwtToken($accessToken)),
173173
]);
174174

175175
$response = $this->client->getResponse();

tests/Acceptance/UpdateClientCommandTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,21 @@ public function testUpdateRelatedModels(string $argument, array $initial, array
2929
$commandTester->execute([
3030
'command' => $command->getName(),
3131
'identifier' => $client->getIdentifier(),
32-
sprintf('--add-%s', $argument) => $toAdd,
33-
sprintf('--remove-%s', $argument) => $toRemove,
32+
\sprintf('--add-%s', $argument) => $toAdd,
33+
\sprintf('--remove-%s', $argument) => $toRemove,
3434
]);
3535
$output = $commandTester->getDisplay();
3636
$this->assertStringContainsString('OAuth2 client updated successfully.', $output);
3737
$this->assertEquals($expected, $client->{$getter}());
3838

3939
$this->expectException(\RuntimeException::class);
40-
$this->expectExceptionMessage(sprintf('Cannot specify "%s" in either "--add-%2$s" and "--remove-%2$s".', $toAdd[0], $argument));
40+
$this->expectExceptionMessage(\sprintf('Cannot specify "%s" in either "--add-%2$s" and "--remove-%2$s".', $toAdd[0], $argument));
4141

4242
$commandTester->execute([
4343
'command' => $command->getName(),
4444
'identifier' => $client->getIdentifier(),
45-
sprintf('--add-%s', $argument) => [$toAdd[0]],
46-
sprintf('--remove-%s', $argument) => [$toAdd[0]],
45+
\sprintf('--add-%s', $argument) => [$toAdd[0]],
46+
\sprintf('--remove-%s', $argument) => [$toAdd[0]],
4747
]);
4848
}
4949

tests/Fixtures/SecurityTestController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function helloAction(): Response
2828
$user = $this->getUser();
2929

3030
return new Response(
31-
sprintf('Hello, %s', null === $user || $user instanceof NullUser ? 'guest' : (method_exists($user, 'getUserIdentifier') ? $user->getUserIdentifier() : $user->getUsername()))
31+
\sprintf('Hello, %s', null === $user || $user instanceof NullUser ? 'guest' : (method_exists($user, 'getUserIdentifier') ? $user->getUserIdentifier() : $user->getUsername()))
3232
);
3333
}
3434

@@ -42,7 +42,7 @@ public function rolesAction(): Response
4242
$roles = $this->tokenStorage->getToken()->getRoleNames();
4343

4444
return new Response(
45-
sprintf(
45+
\sprintf(
4646
'These are the roles I have currently assigned: %s',
4747
implode(', ', $roles)
4848
)

0 commit comments

Comments
 (0)