diff --git a/src/Command/ClearExpiredTokensCommand.php b/src/Command/ClearExpiredTokensCommand.php index 16c6985b..05f1d3ee 100644 --- a/src/Command/ClearExpiredTokensCommand.php +++ b/src/Command/ClearExpiredTokensCommand.php @@ -103,7 +103,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int private function clearExpiredAccessTokens(SymfonyStyle $io): void { $numOfClearedAccessTokens = $this->accessTokenManager->clearExpired(); - $io->success(sprintf( + $io->success(\sprintf( 'Cleared %d expired access token%s.', $numOfClearedAccessTokens, 1 === $numOfClearedAccessTokens ? '' : 's' @@ -113,7 +113,7 @@ private function clearExpiredAccessTokens(SymfonyStyle $io): void private function clearExpiredRefreshTokens(SymfonyStyle $io): void { $numOfClearedRefreshTokens = $this->refreshTokenManager->clearExpired(); - $io->success(sprintf( + $io->success(\sprintf( 'Cleared %d expired refresh token%s.', $numOfClearedRefreshTokens, 1 === $numOfClearedRefreshTokens ? '' : 's' @@ -123,7 +123,7 @@ private function clearExpiredRefreshTokens(SymfonyStyle $io): void private function clearExpiredAuthCodes(SymfonyStyle $io): void { $numOfClearedAuthCodes = $this->authorizationCodeManager->clearExpired(); - $io->success(sprintf( + $io->success(\sprintf( 'Cleared %d expired auth code%s.', $numOfClearedAuthCodes, 1 === $numOfClearedAuthCodes ? '' : 's' diff --git a/src/Command/DeleteClientCommand.php b/src/Command/DeleteClientCommand.php index 73302780..7caae395 100644 --- a/src/Command/DeleteClientCommand.php +++ b/src/Command/DeleteClientCommand.php @@ -44,7 +44,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $io = new SymfonyStyle($input, $output); if (null === $client = $this->clientManager->find($input->getArgument('identifier'))) { - $io->error(sprintf('OAuth2 client identified as "%s" does not exist.', $input->getArgument('identifier'))); + $io->error(\sprintf('OAuth2 client identified as "%s" does not exist.', $input->getArgument('identifier'))); return 1; } diff --git a/src/Command/GenerateKeyPairCommand.php b/src/Command/GenerateKeyPairCommand.php index 4938478b..4b33d4ba 100644 --- a/src/Command/GenerateKeyPairCommand.php +++ b/src/Command/GenerateKeyPairCommand.php @@ -68,7 +68,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $io = new SymfonyStyle($input, $output); if (!\in_array($this->algorithm, self::ACCEPTED_ALGORITHMS, true)) { - $io->error(sprintf('Cannot generate key pair with the provided algorithm `%s`.', $this->algorithm)); + $io->error(\sprintf('Cannot generate key pair with the provided algorithm `%s`.', $this->algorithm)); return Command::FAILURE; } @@ -78,10 +78,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int if ($input->getOption('dry-run')) { $io->success('Your keys have been generated!'); $io->newLine(); - $io->writeln(sprintf('Update your private key in %s:', $this->secretKey)); + $io->writeln(\sprintf('Update your private key in %s:', $this->secretKey)); $io->writeln($secretKey); $io->newLine(); - $io->writeln(sprintf('Update your public key in %s:', $this->publicKey)); + $io->writeln(\sprintf('Update your public key in %s:', $this->publicKey)); $io->writeln($publicKey); return Command::SUCCESS; diff --git a/src/Command/UpdateClientCommand.php b/src/Command/UpdateClientCommand.php index c462a60d..529dd69e 100644 --- a/src/Command/UpdateClientCommand.php +++ b/src/Command/UpdateClientCommand.php @@ -57,7 +57,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $io = new SymfonyStyle($input, $output); if (null === $client = $this->clientManager->find($input->getArgument('identifier'))) { - $io->error(sprintf('OAuth2 client identified as "%s" does not exist.', $input->getArgument('identifier'))); + $io->error(\sprintf('OAuth2 client identified as "%s" does not exist.', $input->getArgument('identifier'))); return 1; } @@ -107,13 +107,13 @@ private function getClientActiveFromInput(InputInterface $input, bool $actual): private function getClientRelatedModelsFromInput(InputInterface $input, string $modelFqcn, array $actual, string $argument): array { /** @var list $toAdd */ - $toAdd = $input->getOption($addArgument = sprintf('add-%s', $argument)); + $toAdd = $input->getOption($addArgument = \sprintf('add-%s', $argument)); /** @var list $toRemove */ - $toRemove = $input->getOption($removeArgument = sprintf('remove-%s', $argument)); + $toRemove = $input->getOption($removeArgument = \sprintf('remove-%s', $argument)); if ([] !== $colliding = array_intersect($toAdd, $toRemove)) { - throw new \RuntimeException(sprintf('Cannot specify "%s" in either "--%s" and "--%s".', implode('", "', $colliding), $addArgument, $removeArgument)); + throw new \RuntimeException(\sprintf('Cannot specify "%s" in either "--%s" and "--%s".', implode('", "', $colliding), $addArgument, $removeArgument)); } $filtered = array_filter($actual, static function ($model) use ($toRemove): bool { diff --git a/src/DBAL/Type/ImplodedArray.php b/src/DBAL/Type/ImplodedArray.php index 89d7ddae..3da2c536 100644 --- a/src/DBAL/Type/ImplodedArray.php +++ b/src/DBAL/Type/ImplodedArray.php @@ -83,7 +83,7 @@ private function assertValueCanBeImploded($value): void return; } - throw new \InvalidArgumentException(sprintf('The value of \'%s\' type cannot be imploded.', \gettype($value))); + throw new \InvalidArgumentException(\sprintf('The value of \'%s\' type cannot be imploded.', \gettype($value))); } /** diff --git a/src/DependencyInjection/CompilerPass/EncryptionKeyPass.php b/src/DependencyInjection/CompilerPass/EncryptionKeyPass.php index 04e8fb35..d453d36a 100644 --- a/src/DependencyInjection/CompilerPass/EncryptionKeyPass.php +++ b/src/DependencyInjection/CompilerPass/EncryptionKeyPass.php @@ -44,6 +44,6 @@ public function process(ContainerBuilder $container): void return; } - 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)); + 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)); } } diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 3ab21af2..c3566b79 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -55,7 +55,7 @@ private function createAuthorizationServerNode(): NodeDefinition ->defaultValue(null) ->end() ->scalarNode('encryption_key') - ->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)) + ->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)) ->isRequired() ->cannotBeEmpty() ->end() @@ -240,13 +240,13 @@ private function createClientNode(): NodeDefinition ->addDefaultsIfNotSet() ->children() ->scalarNode('classname') - ->info(sprintf('Set a custom client class. Must be a %s', AbstractClient::class)) + ->info(\sprintf('Set a custom client class. Must be a %s', AbstractClient::class)) ->defaultValue(Client::class) ->validate() ->ifTrue(function ($v) { return !is_a($v, AbstractClient::class, true); }) - ->thenInvalid(sprintf('%%s must be a %s', AbstractClient::class)) + ->thenInvalid(\sprintf('%%s must be a %s', AbstractClient::class)) ->end() ->end() ->end() diff --git a/src/DependencyInjection/LeagueOAuth2ServerExtension.php b/src/DependencyInjection/LeagueOAuth2ServerExtension.php index 25e76df3..1abf8809 100644 --- a/src/DependencyInjection/LeagueOAuth2ServerExtension.php +++ b/src/DependencyInjection/LeagueOAuth2ServerExtension.php @@ -126,7 +126,7 @@ private function assertRequiredBundlesAreEnabled(ContainerBuilder $container): v foreach ($requiredBundles as $bundleAlias => $requiredBundle) { if (!$container->hasExtension($bundleAlias)) { - throw new \LogicException(sprintf('Bundle \'%s\' needs to be enabled in your application kernel.', $requiredBundle)); + throw new \LogicException(\sprintf('Bundle \'%s\' needs to be enabled in your application kernel.', $requiredBundle)); } } } @@ -260,7 +260,7 @@ private function configureDoctrinePersistence(ContainerBuilder $container, array $entityManagerName = $persistenceConfig['entity_manager']; $entityManager = new Reference( - sprintf('doctrine.orm.%s_entity_manager', $entityManagerName) + \sprintf('doctrine.orm.%s_entity_manager', $entityManagerName) ); $container @@ -339,7 +339,7 @@ private function configureScopes(ContainerBuilder $container, array $scopes): vo $defaultScopes = $scopes['default']; if ([] !== $invalidDefaultScopes = array_diff($defaultScopes, $availableScopes)) { - throw new \LogicException(sprintf('Invalid default scopes "%s" for path "league_oauth2_server.scopes.default". Permissible values: "%s"', implode('", "', $invalidDefaultScopes), implode('", "', $availableScopes))); + throw new \LogicException(\sprintf('Invalid default scopes "%s" for path "league_oauth2_server.scopes.default". Permissible values: "%s"', implode('", "', $invalidDefaultScopes), implode('", "', $availableScopes))); } $container->setParameter('league.oauth2_server.scopes.default', $defaultScopes); diff --git a/src/DependencyInjection/Security/OAuth2FactoryTrait.php b/src/DependencyInjection/Security/OAuth2FactoryTrait.php index 95d339ea..9453ec3a 100644 --- a/src/DependencyInjection/Security/OAuth2FactoryTrait.php +++ b/src/DependencyInjection/Security/OAuth2FactoryTrait.php @@ -23,7 +23,7 @@ public function create(ContainerBuilder $container, $id, $config, $userProvider, public function createAuthenticator(ContainerBuilder $container, string $firewallName, array $config, string $userProviderId): string { - $authenticator = sprintf('security.authenticator.oauth2.%s', $firewallName); + $authenticator = \sprintf('security.authenticator.oauth2.%s', $firewallName); $definition = new ChildDefinition(OAuth2Authenticator::class); $definition->replaceArgument(2, new Reference($userProviderId)); diff --git a/src/Event/AuthorizationRequestResolveEventFactory.php b/src/Event/AuthorizationRequestResolveEventFactory.php index 07bc2a9f..c928a62d 100644 --- a/src/Event/AuthorizationRequestResolveEventFactory.php +++ b/src/Event/AuthorizationRequestResolveEventFactory.php @@ -33,7 +33,7 @@ public function fromAuthorizationRequest(AuthorizationRequest $authorizationRequ $client = $this->clientManager->find($authorizationRequest->getClient()->getIdentifier()); if (null === $client) { - throw new \RuntimeException(sprintf('No client found for the given identifier \'%s\'.', $authorizationRequest->getClient()->getIdentifier())); + throw new \RuntimeException(\sprintf('No client found for the given identifier \'%s\'.', $authorizationRequest->getClient()->getIdentifier())); } return new AuthorizationRequestResolveEvent($authorizationRequest, $scopes, $client); diff --git a/src/Persistence/Mapping/Driver.php b/src/Persistence/Mapping/Driver.php index 9e2b8acb..126e0330 100644 --- a/src/Persistence/Mapping/Driver.php +++ b/src/Persistence/Mapping/Driver.php @@ -62,7 +62,7 @@ public function loadMetadataForClass($className, ClassMetadata $metadata): void break; default: - throw new \RuntimeException(sprintf('%s cannot load metadata for class %s', __CLASS__, $className)); + throw new \RuntimeException(\sprintf('%s cannot load metadata for class %s', __CLASS__, $className)); } } diff --git a/src/Security/Authentication/Token/OAuth2Token.php b/src/Security/Authentication/Token/OAuth2Token.php index a9dc7c33..53c225ee 100644 --- a/src/Security/Authentication/Token/OAuth2Token.php +++ b/src/Security/Authentication/Token/OAuth2Token.php @@ -28,7 +28,7 @@ public function __construct( // Build roles from scope $roles = array_map(function (string $scope) use ($rolePrefix): string { - return strtoupper(trim(sprintf('%s%s', $rolePrefix, $scope))); + return strtoupper(trim(\sprintf('%s%s', $rolePrefix, $scope))); }, $scopes); if (null !== $user) { diff --git a/src/Security/Authenticator/OAuth2Authenticator.php b/src/Security/Authenticator/OAuth2Authenticator.php index ffd98d7a..2050ee79 100644 --- a/src/Security/Authenticator/OAuth2Authenticator.php +++ b/src/Security/Authenticator/OAuth2Authenticator.php @@ -123,7 +123,7 @@ public function doAuthenticate(Request $request) /* : Passport */ public function createAuthenticatedToken(PassportInterface $passport, string $firewallName): TokenInterface { if (!$passport instanceof Passport) { - throw new \RuntimeException(sprintf('Cannot create a OAuth2 authenticated token. $passport should be a %s', Passport::class)); + throw new \RuntimeException(\sprintf('Cannot create a OAuth2 authenticated token. $passport should be a %s', Passport::class)); } $token = $this->createToken($passport, $firewallName); diff --git a/src/ValueObject/RedirectUri.php b/src/ValueObject/RedirectUri.php index f8450a82..c4f2b70e 100644 --- a/src/ValueObject/RedirectUri.php +++ b/src/ValueObject/RedirectUri.php @@ -20,7 +20,7 @@ class RedirectUri public function __construct(string $redirectUri) { if (!filter_var($redirectUri, \FILTER_VALIDATE_URL)) { - throw new \RuntimeException(sprintf('The \'%s\' string is not a valid URI.', $redirectUri)); + throw new \RuntimeException(\sprintf('The \'%s\' string is not a valid URI.', $redirectUri)); } $this->redirectUri = $redirectUri; diff --git a/tests/Acceptance/DeleteClientCommandTest.php b/tests/Acceptance/DeleteClientCommandTest.php index 9de26327..cf973821 100644 --- a/tests/Acceptance/DeleteClientCommandTest.php +++ b/tests/Acceptance/DeleteClientCommandTest.php @@ -42,7 +42,7 @@ public function testDeleteNonExistentClient(): void 'identifier' => $identifierName, ]); $output = $commandTester->getDisplay(); - $this->assertStringContainsString(sprintf('OAuth2 client identified as "%s" does not exist.', $identifierName), $output); + $this->assertStringContainsString(\sprintf('OAuth2 client identified as "%s" does not exist.', $identifierName), $output); } private function findClient(string $identifier): ?Client diff --git a/tests/Acceptance/SecurityLayerTest.php b/tests/Acceptance/SecurityLayerTest.php index e54d6933..f67272f9 100644 --- a/tests/Acceptance/SecurityLayerTest.php +++ b/tests/Acceptance/SecurityLayerTest.php @@ -35,7 +35,7 @@ public function testAuthenticatedGuestRequest(): void ->find(FixtureFactory::FIXTURE_ACCESS_TOKEN_PUBLIC); $this->client->request('GET', '/security-test', [], [], [ - 'HTTP_AUTHORIZATION' => sprintf('Bearer %s', TestHelper::generateJwtToken($accessToken)), + 'HTTP_AUTHORIZATION' => \sprintf('Bearer %s', TestHelper::generateJwtToken($accessToken)), ]); $response = $this->client->getResponse(); @@ -52,7 +52,7 @@ public function testAuthenticatedGuestScopedRequest(): void ->find(FixtureFactory::FIXTURE_ACCESS_TOKEN_WITH_SCOPES); $this->client->request('GET', '/security-test-scopes', [], [], [ - 'HTTP_AUTHORIZATION' => sprintf('Bearer %s', TestHelper::generateJwtToken($accessToken)), + 'HTTP_AUTHORIZATION' => \sprintf('Bearer %s', TestHelper::generateJwtToken($accessToken)), ]); $response = $this->client->getResponse(); @@ -69,7 +69,7 @@ public function testAuthenticatedUserRequest(): void ->find(FixtureFactory::FIXTURE_ACCESS_TOKEN_USER_BOUND); $this->client->request('GET', '/security-test', [], [], [ - 'HTTP_AUTHORIZATION' => sprintf('Bearer %s', TestHelper::generateJwtToken($accessToken)), + 'HTTP_AUTHORIZATION' => \sprintf('Bearer %s', TestHelper::generateJwtToken($accessToken)), ]); $response = $this->client->getResponse(); @@ -86,7 +86,7 @@ public function testAuthenticatedUserRolesRequest(): void ->find(FixtureFactory::FIXTURE_ACCESS_TOKEN_USER_BOUND_WITH_SCOPES); $this->client->request('GET', '/security-test-roles', [], [], [ - 'HTTP_AUTHORIZATION' => sprintf('Bearer %s', TestHelper::generateJwtToken($accessToken)), + 'HTTP_AUTHORIZATION' => \sprintf('Bearer %s', TestHelper::generateJwtToken($accessToken)), ]); $response = $this->client->getResponse(); @@ -103,7 +103,7 @@ public function testSuccessfulAuthorizationForAuthenticatedUserRequest(): void ->find(FixtureFactory::FIXTURE_ACCESS_TOKEN_USER_BOUND_WITH_SCOPES); $this->client->request('GET', '/security-test-authorization', [], [], [ - 'HTTP_AUTHORIZATION' => sprintf('Bearer %s', TestHelper::generateJwtToken($accessToken)), + 'HTTP_AUTHORIZATION' => \sprintf('Bearer %s', TestHelper::generateJwtToken($accessToken)), ]); $response = $this->client->getResponse(); @@ -120,7 +120,7 @@ public function testUnsuccessfulAuthorizationForAuthenticatedUserRequest(): void ->find(FixtureFactory::FIXTURE_ACCESS_TOKEN_USER_BOUND); $this->client->request('GET', '/security-test-authorization', [], [], [ - 'HTTP_AUTHORIZATION' => sprintf('Bearer %s', TestHelper::generateJwtToken($accessToken)), + 'HTTP_AUTHORIZATION' => \sprintf('Bearer %s', TestHelper::generateJwtToken($accessToken)), ]); $response = $this->client->getResponse(); @@ -137,7 +137,7 @@ public function testExpiredRequest(): void ->find(FixtureFactory::FIXTURE_ACCESS_TOKEN_EXPIRED); $this->client->request('GET', '/security-test', [], [], [ - 'HTTP_AUTHORIZATION' => sprintf('Bearer %s', TestHelper::generateJwtToken($accessToken)), + 'HTTP_AUTHORIZATION' => \sprintf('Bearer %s', TestHelper::generateJwtToken($accessToken)), ]); $response = $this->client->getResponse(); @@ -153,7 +153,7 @@ public function testRevokedRequest(): void ->find(FixtureFactory::FIXTURE_ACCESS_TOKEN_REVOKED); $this->client->request('GET', '/security-test', [], [], [ - 'HTTP_AUTHORIZATION' => sprintf('Bearer %s', TestHelper::generateJwtToken($accessToken)), + 'HTTP_AUTHORIZATION' => \sprintf('Bearer %s', TestHelper::generateJwtToken($accessToken)), ]); $response = $this->client->getResponse(); @@ -169,7 +169,7 @@ public function testInsufficientScopeRequest(): void ->find(FixtureFactory::FIXTURE_ACCESS_TOKEN_PUBLIC); $this->client->request('GET', '/security-test-scopes', [], [], [ - 'HTTP_AUTHORIZATION' => sprintf('Bearer %s', TestHelper::generateJwtToken($accessToken)), + 'HTTP_AUTHORIZATION' => \sprintf('Bearer %s', TestHelper::generateJwtToken($accessToken)), ]); $response = $this->client->getResponse(); diff --git a/tests/Acceptance/UpdateClientCommandTest.php b/tests/Acceptance/UpdateClientCommandTest.php index 77ae5430..c0150206 100644 --- a/tests/Acceptance/UpdateClientCommandTest.php +++ b/tests/Acceptance/UpdateClientCommandTest.php @@ -29,21 +29,21 @@ public function testUpdateRelatedModels(string $argument, array $initial, array $commandTester->execute([ 'command' => $command->getName(), 'identifier' => $client->getIdentifier(), - sprintf('--add-%s', $argument) => $toAdd, - sprintf('--remove-%s', $argument) => $toRemove, + \sprintf('--add-%s', $argument) => $toAdd, + \sprintf('--remove-%s', $argument) => $toRemove, ]); $output = $commandTester->getDisplay(); $this->assertStringContainsString('OAuth2 client updated successfully.', $output); $this->assertEquals($expected, $client->{$getter}()); $this->expectException(\RuntimeException::class); - $this->expectExceptionMessage(sprintf('Cannot specify "%s" in either "--add-%2$s" and "--remove-%2$s".', $toAdd[0], $argument)); + $this->expectExceptionMessage(\sprintf('Cannot specify "%s" in either "--add-%2$s" and "--remove-%2$s".', $toAdd[0], $argument)); $commandTester->execute([ 'command' => $command->getName(), 'identifier' => $client->getIdentifier(), - sprintf('--add-%s', $argument) => [$toAdd[0]], - sprintf('--remove-%s', $argument) => [$toAdd[0]], + \sprintf('--add-%s', $argument) => [$toAdd[0]], + \sprintf('--remove-%s', $argument) => [$toAdd[0]], ]); } diff --git a/tests/Fixtures/SecurityTestController.php b/tests/Fixtures/SecurityTestController.php index 47d8dd1d..c6739f31 100644 --- a/tests/Fixtures/SecurityTestController.php +++ b/tests/Fixtures/SecurityTestController.php @@ -28,7 +28,7 @@ public function helloAction(): Response $user = $this->getUser(); return new Response( - sprintf('Hello, %s', null === $user || $user instanceof NullUser ? 'guest' : (method_exists($user, 'getUserIdentifier') ? $user->getUserIdentifier() : $user->getUsername())) + \sprintf('Hello, %s', null === $user || $user instanceof NullUser ? 'guest' : (method_exists($user, 'getUserIdentifier') ? $user->getUserIdentifier() : $user->getUsername())) ); } @@ -42,7 +42,7 @@ public function rolesAction(): Response $roles = $this->tokenStorage->getToken()->getRoleNames(); return new Response( - sprintf( + \sprintf( 'These are the roles I have currently assigned: %s', implode(', ', $roles) ) diff --git a/tests/Integration/AbstractIntegrationTest.php b/tests/Integration/AbstractIntegrationTest.php index 51acbb05..d4d09a49 100644 --- a/tests/Integration/AbstractIntegrationTest.php +++ b/tests/Integration/AbstractIntegrationTest.php @@ -173,7 +173,7 @@ protected function createAuthorizationRequest(?string $credentials, array $body ; if (null !== $credentials) { - $request = $request->withHeader('Authorization', sprintf('Basic %s', base64_encode($credentials))); + $request = $request->withHeader('Authorization', \sprintf('Basic %s', base64_encode($credentials))); } return $request; @@ -184,7 +184,7 @@ protected function createResourceRequest(string $jwtToken): ServerRequestInterfa return $this ->psrFactory ->createServerRequest('', '') - ->withHeader('Authorization', sprintf('Bearer %s', $jwtToken)) + ->withHeader('Authorization', \sprintf('Bearer %s', $jwtToken)) ; } @@ -196,7 +196,7 @@ protected function createAuthorizeRequest(?string $credentials, array $query = [ ->withQueryParams($query) ; - return \is_string($credentials) ? $serverRequest->withHeader('Authorization', sprintf('Basic %s', base64_encode($credentials))) : $serverRequest; + return \is_string($credentials) ? $serverRequest->withHeader('Authorization', \sprintf('Basic %s', base64_encode($credentials))) : $serverRequest; } protected function handleTokenRequest(ServerRequestInterface $serverRequest): array diff --git a/tests/TestKernel.php b/tests/TestKernel.php index dbd560c6..89d9f40b 100644 --- a/tests/TestKernel.php +++ b/tests/TestKernel.php @@ -52,12 +52,12 @@ public function registerBundles(): iterable public function getCacheDir(): string { - return sprintf('%s/tests/.kernel/cache', $this->getProjectDir()); + return \sprintf('%s/tests/.kernel/cache', $this->getProjectDir()); } public function getLogDir(): string { - return sprintf('%s/tests/.kernel/logs', $this->getProjectDir()); + return \sprintf('%s/tests/.kernel/logs', $this->getProjectDir()); } public function process(ContainerBuilder $container): void @@ -235,8 +235,8 @@ private function registerFakeGrant(ContainerBuilder $container): void private function initializeEnvironmentVariables(): void { - putenv(sprintf('PRIVATE_KEY_PATH=%s', TestHelper::PRIVATE_KEY_PATH)); - putenv(sprintf('PUBLIC_KEY_PATH=%s', TestHelper::PUBLIC_KEY_PATH)); - putenv(sprintf('ENCRYPTION_KEY=%s', TestHelper::ENCRYPTION_KEY)); + putenv(\sprintf('PRIVATE_KEY_PATH=%s', TestHelper::PRIVATE_KEY_PATH)); + putenv(\sprintf('PUBLIC_KEY_PATH=%s', TestHelper::PUBLIC_KEY_PATH)); + putenv(\sprintf('ENCRYPTION_KEY=%s', TestHelper::ENCRYPTION_KEY)); } } diff --git a/tests/Unit/OAuth2TokenTest.php b/tests/Unit/OAuth2TokenTest.php index b0bcc4e4..ba37373d 100644 --- a/tests/Unit/OAuth2TokenTest.php +++ b/tests/Unit/OAuth2TokenTest.php @@ -29,7 +29,7 @@ public function testTokenSerialization(): void $this->assertSame($accessTokenId, $token->getCredentials()); $this->assertSame($oauthClientId, $token->getOAuthClientId()); $this->assertSame($scopes, $token->getScopes()); - $this->assertSame([sprintf('%s%s', $rolePrefix, strtoupper($scopes[0]))], $token->getRoleNames()); + $this->assertSame([\sprintf('%s%s', $rolePrefix, strtoupper($scopes[0]))], $token->getRoleNames()); if (!interface_exists(CacheableVoterInterface::class)) { $this->assertFalse($unserializedToken->isAuthenticated());