Skip to content

Commit a687530

Browse files
committed
Leverage class name literal on object
1 parent 14c79cf commit a687530

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

Authentication/AuthenticatorManager.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,14 @@ private function executeAuthenticators(array $authenticators, Request $request):
146146
// eagerly (before token storage is initialized), whereas authenticate() is called
147147
// lazily (after initialization).
148148
if (false === $authenticator->supports($request)) {
149-
$this->logger?->debug('Skipping the "{authenticator}" authenticator as it did not support the request.', ['authenticator' => \get_class($authenticator instanceof TraceableAuthenticator ? $authenticator->getAuthenticator() : $authenticator)]);
149+
$this->logger?->debug('Skipping the "{authenticator}" authenticator as it did not support the request.', ['authenticator' => ($authenticator instanceof TraceableAuthenticator ? $authenticator->getAuthenticator() : $authenticator)::class]);
150150

151151
continue;
152152
}
153153

154154
$response = $this->executeAuthenticator($authenticator, $request);
155155
if (null !== $response) {
156-
$this->logger?->debug('The "{authenticator}" authenticator set the response. Any later authenticator will not be called', ['authenticator' => \get_class($authenticator instanceof TraceableAuthenticator ? $authenticator->getAuthenticator() : $authenticator)]);
156+
$this->logger?->debug('The "{authenticator}" authenticator set the response. Any later authenticator will not be called', ['authenticator' => ($authenticator instanceof TraceableAuthenticator ? $authenticator->getAuthenticator() : $authenticator)::class]);
157157

158158
return $response;
159159
}
@@ -201,7 +201,7 @@ private function executeAuthenticator(AuthenticatorInterface $authenticator, Req
201201

202202
$this->eventDispatcher->dispatch(new AuthenticationSuccessEvent($authenticatedToken), AuthenticationEvents::AUTHENTICATION_SUCCESS);
203203

204-
$this->logger?->info('Authenticator successful!', ['token' => $authenticatedToken, 'authenticator' => \get_class($authenticator instanceof TraceableAuthenticator ? $authenticator->getAuthenticator() : $authenticator)]);
204+
$this->logger?->info('Authenticator successful!', ['token' => $authenticatedToken, 'authenticator' => ($authenticator instanceof TraceableAuthenticator ? $authenticator->getAuthenticator() : $authenticator)::class]);
205205
} catch (AuthenticationException $e) {
206206
// oh no! Authentication failed!
207207
$response = $this->handleAuthenticationFailure($e, $request, $authenticator, $passport);
@@ -218,7 +218,7 @@ private function executeAuthenticator(AuthenticatorInterface $authenticator, Req
218218
return $response;
219219
}
220220

221-
$this->logger?->debug('Authenticator set no success response: request continues.', ['authenticator' => \get_class($authenticator instanceof TraceableAuthenticator ? $authenticator->getAuthenticator() : $authenticator)]);
221+
$this->logger?->debug('Authenticator set no success response: request continues.', ['authenticator' => ($authenticator instanceof TraceableAuthenticator ? $authenticator->getAuthenticator() : $authenticator)::class]);
222222

223223
return null;
224224
}
@@ -243,7 +243,7 @@ private function handleAuthenticationSuccess(TokenInterface $authenticatedToken,
243243
*/
244244
private function handleAuthenticationFailure(AuthenticationException $authenticationException, Request $request, AuthenticatorInterface $authenticator, ?Passport $passport): ?Response
245245
{
246-
$this->logger?->info('Authenticator failed.', ['exception' => $authenticationException, 'authenticator' => \get_class($authenticator instanceof TraceableAuthenticator ? $authenticator->getAuthenticator() : $authenticator)]);
246+
$this->logger?->info('Authenticator failed.', ['exception' => $authenticationException, 'authenticator' => ($authenticator instanceof TraceableAuthenticator ? $authenticator->getAuthenticator() : $authenticator)::class]);
247247

248248
// Avoid leaking error details in case of invalid user (e.g. user not found or invalid account status)
249249
// to prevent user enumeration via response content comparison
@@ -253,7 +253,7 @@ private function handleAuthenticationFailure(AuthenticationException $authentica
253253

254254
$response = $authenticator->onAuthenticationFailure($request, $authenticationException);
255255
if (null !== $response && null !== $this->logger) {
256-
$this->logger->debug('The "{authenticator}" authenticator set the failure response.', ['authenticator' => \get_class($authenticator instanceof TraceableAuthenticator ? $authenticator->getAuthenticator() : $authenticator)]);
256+
$this->logger->debug('The "{authenticator}" authenticator set the failure response.', ['authenticator' => ($authenticator instanceof TraceableAuthenticator ? $authenticator->getAuthenticator() : $authenticator)::class]);
257257
}
258258

259259
$this->eventDispatcher->dispatch($loginFailureEvent = new LoginFailureEvent($authenticationException, $authenticator, $request, $response, $this->firewallName, $passport));

Authenticator/Debug/TraceableAuthenticator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function getInfo(): array
4545
'supports' => true,
4646
'passport' => $this->passport,
4747
'duration' => $this->duration,
48-
'stub' => $this->stub ??= class_exists(ClassStub::class) ? new ClassStub(\get_class($this->authenticator)) : \get_class($this->authenticator),
48+
'stub' => $this->stub ??= class_exists(ClassStub::class) ? new ClassStub($this->authenticator::class) : $this->authenticator::class,
4949
];
5050
}
5151

EventListener/RememberMeListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function onSuccessfulLogin(LoginSuccessEvent $event): void
4747
{
4848
$passport = $event->getPassport();
4949
if (!$passport->hasBadge(RememberMeBadge::class)) {
50-
$this->logger?->debug('Remember me skipped: your authenticator does not support it.', ['authenticator' => \get_class($event->getAuthenticator())]);
50+
$this->logger?->debug('Remember me skipped: your authenticator does not support it.', ['authenticator' => $event->getAuthenticator()::class]);
5151

5252
return;
5353
}

0 commit comments

Comments
 (0)