Skip to content

Commit bd6ce06

Browse files
CS fixes
1 parent 815fcda commit bd6ce06

35 files changed

+70
-66
lines changed

AccessToken/FormEncodedBodyExtractor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
final class FormEncodedBodyExtractor implements AccessTokenExtractorInterface
2929
{
3030
public function __construct(
31-
private readonly string $parameter = 'access_token'
31+
private readonly string $parameter = 'access_token',
3232
) {
3333
}
3434

AccessToken/HeaderAccessTokenExtractor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ final class HeaderAccessTokenExtractor implements AccessTokenExtractorInterface
2626

2727
public function __construct(
2828
private readonly string $headerParameter = 'Authorization',
29-
private readonly string $tokenType = 'Bearer'
29+
private readonly string $tokenType = 'Bearer',
3030
) {
31-
$this->regex = sprintf(
31+
$this->regex = \sprintf(
3232
'/^%s([a-zA-Z0-9\-_\+~\/\.]+=*)$/',
3333
'' === $this->tokenType ? '' : preg_quote($this->tokenType).'\s+'
3434
);

AccessToken/Oidc/OidcTokenHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function __construct(
4444
private array $issuers,
4545
private string $claim = 'sub',
4646
private ?LoggerInterface $logger = null,
47-
private ClockInterface $clock = new Clock()
47+
private ClockInterface $clock = new Clock(),
4848
) {
4949
}
5050

@@ -88,7 +88,7 @@ public function getUserBadgeFrom(string $accessToken): UserBadge
8888
$claimCheckerManager->check($claims);
8989

9090
if (empty($claims[$this->claim])) {
91-
throw new MissingClaimException(sprintf('"%s" claim not found.', $this->claim));
91+
throw new MissingClaimException(\sprintf('"%s" claim not found.', $this->claim));
9292
}
9393

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

AccessToken/Oidc/OidcUserInfoTokenHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ final class OidcUserInfoTokenHandler implements AccessTokenHandlerInterface
2929
public function __construct(
3030
private HttpClientInterface $client,
3131
private ?LoggerInterface $logger = null,
32-
private string $claim = 'sub'
32+
private string $claim = 'sub',
3333
) {
3434
}
3535

@@ -43,7 +43,7 @@ public function getUserBadgeFrom(string $accessToken): UserBadge
4343
])->toArray();
4444

4545
if (empty($claims[$this->claim])) {
46-
throw new MissingClaimException(sprintf('"%s" claim not found on OIDC server response.', $this->claim));
46+
throw new MissingClaimException(\sprintf('"%s" claim not found on OIDC server response.', $this->claim));
4747
}
4848

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

Authentication/AuthenticatorManager.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public function supports(Request $request): ?bool
105105
$this->logger?->debug('Checking support on authenticator.', ['firewall_name' => $this->firewallName, 'authenticator' => $authenticator::class]);
106106

107107
if (!$authenticator instanceof AuthenticatorInterface) {
108-
throw new \InvalidArgumentException(sprintf('Authenticator "%s" must implement "%s".', get_debug_type($authenticator), AuthenticatorInterface::class));
108+
throw new \InvalidArgumentException(\sprintf('Authenticator "%s" must implement "%s".', get_debug_type($authenticator), AuthenticatorInterface::class));
109109
}
110110

111111
if (false !== $supports = $authenticator->supports($request)) {
@@ -183,15 +183,15 @@ private function executeAuthenticator(AuthenticatorInterface $authenticator, Req
183183
$resolvedBadges = [];
184184
foreach ($passport->getBadges() as $badge) {
185185
if (!$badge->isResolved()) {
186-
throw new BadCredentialsException(sprintf('Authentication failed: Security badge "%s" is not resolved, did you forget to register the correct listeners?', get_debug_type($badge)));
186+
throw new BadCredentialsException(\sprintf('Authentication failed: Security badge "%s" is not resolved, did you forget to register the correct listeners?', get_debug_type($badge)));
187187
}
188188

189189
$resolvedBadges[] = $badge::class;
190190
}
191191

192192
$missingRequiredBadges = array_diff($this->requiredBadges, $resolvedBadges);
193193
if ($missingRequiredBadges) {
194-
throw new BadCredentialsException(sprintf('Authentication failed; Some badges marked as required by the firewall config are not available on the passport: "%s".', implode('", "', $missingRequiredBadges)));
194+
throw new BadCredentialsException(\sprintf('Authentication failed; Some badges marked as required by the firewall config are not available on the passport: "%s".', implode('", "', $missingRequiredBadges)));
195195
}
196196

197197
// create the authentication token

Authentication/DefaultAuthenticationFailureHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function onAuthenticationFailure(Request $request, AuthenticationExceptio
7575
if (\is_string($failureUrl) && (str_starts_with($failureUrl, '/') || str_starts_with($failureUrl, 'http'))) {
7676
$options['failure_path'] = $failureUrl;
7777
} elseif ($this->logger && $failureUrl) {
78-
$this->logger->debug(sprintf('Ignoring query parameter "%s": not a valid URL.', $options['failure_path_parameter']));
78+
$this->logger->debug(\sprintf('Ignoring query parameter "%s": not a valid URL.', $options['failure_path_parameter']));
7979
}
8080

8181
$options['failure_path'] ??= $options['login_path'];

Authentication/DefaultAuthenticationSuccessHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ protected function determineTargetUrl(Request $request): string
9999
}
100100

101101
if ($this->logger && $targetUrl) {
102-
$this->logger->debug(sprintf('Ignoring query parameter "%s": not a valid URL.', $this->options['target_path_parameter']));
102+
$this->logger->debug(\sprintf('Ignoring query parameter "%s": not a valid URL.', $this->options['target_path_parameter']));
103103
}
104104

105105
$firewallName = $this->getFirewallName();

Authenticator/AccessTokenAuthenticator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,9 @@ private function getAuthenticateHeader(?string $errorDescription = null): string
118118
if (null === $v || '' === $v) {
119119
continue;
120120
}
121-
$values[] = sprintf('%s="%s"', $k, $v);
121+
$values[] = \sprintf('%s="%s"', $k, $v);
122122
}
123123

124-
return sprintf('Bearer %s', implode(',', $values));
124+
return \sprintf('Bearer %s', implode(',', $values));
125125
}
126126
}

Authenticator/FormLoginAuthenticator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,19 +124,19 @@ private function getCredentials(Request $request): array
124124
}
125125

126126
if (!\is_string($credentials['username']) && !$credentials['username'] instanceof \Stringable) {
127-
throw new BadRequestHttpException(sprintf('The key "%s" must be a string, "%s" given.', $this->options['username_parameter'], \gettype($credentials['username'])));
127+
throw new BadRequestHttpException(\sprintf('The key "%s" must be a string, "%s" given.', $this->options['username_parameter'], \gettype($credentials['username'])));
128128
}
129129

130130
$credentials['username'] = trim($credentials['username']);
131131

132132
$request->getSession()->set(SecurityRequestAttributes::LAST_USERNAME, $credentials['username']);
133133

134134
if (!\is_string($credentials['password']) && (!\is_object($credentials['password']) || !method_exists($credentials['password'], '__toString'))) {
135-
throw new BadRequestHttpException(sprintf('The key "%s" must be a string, "%s" given.', $this->options['password_parameter'], \gettype($credentials['password'])));
135+
throw new BadRequestHttpException(\sprintf('The key "%s" must be a string, "%s" given.', $this->options['password_parameter'], \gettype($credentials['password'])));
136136
}
137137

138138
if (!\is_string($credentials['csrf_token'] ?? '') && (!\is_object($credentials['csrf_token']) || !method_exists($credentials['csrf_token'], '__toString'))) {
139-
throw new BadRequestHttpException(sprintf('The key "%s" must be a string, "%s" given.', $this->options['csrf_parameter'], \gettype($credentials['csrf_token'])));
139+
throw new BadRequestHttpException(\sprintf('The key "%s" must be a string, "%s" given.', $this->options['csrf_parameter'], \gettype($credentials['csrf_token'])));
140140
}
141141

142142
return $credentials;

Authenticator/HttpBasicAuthenticator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function __construct(string $realmName, UserProviderInterface $userProvid
4747
public function start(Request $request, ?AuthenticationException $authException = null): Response
4848
{
4949
$response = new Response();
50-
$response->headers->set('WWW-Authenticate', sprintf('Basic realm="%s"', $this->realmName));
50+
$response->headers->set('WWW-Authenticate', \sprintf('Basic realm="%s"', $this->realmName));
5151
$response->setStatusCode(401);
5252

5353
return $response;

0 commit comments

Comments
 (0)