Skip to content

Commit 0108363

Browse files
javiereguiluzfabpot
authored andcommitted
Standardize the name of the exception variables
1 parent dd674c5 commit 0108363

7 files changed

+23
-23
lines changed

Firewall/AbstractPreAuthenticatedListener.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ final public function handle(GetResponseEvent $event)
6262

6363
try {
6464
list($user, $credentials) = $this->getPreAuthenticatedData($request);
65-
} catch (BadCredentialsException $exception) {
66-
$this->clearToken($exception);
65+
} catch (BadCredentialsException $e) {
66+
$this->clearToken($e);
6767

6868
return;
6969
}
@@ -90,8 +90,8 @@ final public function handle(GetResponseEvent $event)
9090
$loginEvent = new InteractiveLoginEvent($request, $token);
9191
$this->dispatcher->dispatch(SecurityEvents::INTERACTIVE_LOGIN, $loginEvent);
9292
}
93-
} catch (AuthenticationException $failed) {
94-
$this->clearToken($failed);
93+
} catch (AuthenticationException $e) {
94+
$this->clearToken($e);
9595
}
9696
}
9797

Firewall/BasicAuthenticationListener.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,21 +73,21 @@ public function handle(GetResponseEvent $event)
7373
try {
7474
$token = $this->authenticationManager->authenticate(new UsernamePasswordToken($username, $request->headers->get('PHP_AUTH_PW'), $this->providerKey));
7575
$this->securityContext->setToken($token);
76-
} catch (AuthenticationException $failed) {
76+
} catch (AuthenticationException $e) {
7777
$token = $this->securityContext->getToken();
7878
if ($token instanceof UsernamePasswordToken && $this->providerKey === $token->getProviderKey()) {
7979
$this->securityContext->setToken(null);
8080
}
8181

8282
if (null !== $this->logger) {
83-
$this->logger->info(sprintf('Authentication request failed for user "%s": %s', $username, $failed->getMessage()));
83+
$this->logger->info(sprintf('Authentication request failed for user "%s": %s', $username, $e->getMessage()));
8484
}
8585

8686
if ($this->ignoreFailure) {
8787
return;
8888
}
8989

90-
$event->setResponse($this->authenticationEntryPoint->start($request, $failed));
90+
$event->setResponse($this->authenticationEntryPoint->start($request, $e));
9191
}
9292
}
9393
}

Firewall/ContextListener.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,11 @@ private function refreshUser(TokenInterface $token)
167167
}
168168

169169
return $token;
170-
} catch (UnsupportedUserException $unsupported) {
170+
} catch (UnsupportedUserException $e) {
171171
// let's try the next user provider
172-
} catch (UsernameNotFoundException $notFound) {
172+
} catch (UsernameNotFoundException $e) {
173173
if (null !== $this->logger) {
174-
$this->logger->warning(sprintf('Username "%s" could not be found.', $notFound->getUsername()));
174+
$this->logger->warning(sprintf('Username "%s" could not be found.', $e->getUsername()));
175175
}
176176

177177
return;

Firewall/DigestAuthenticationListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function handle(GetResponseEvent $event)
9393
}
9494

9595
$serverDigestMd5 = $digestAuth->calculateServerDigest($user->getPassword(), $request->getMethod());
96-
} catch (UsernameNotFoundException $notFound) {
96+
} catch (UsernameNotFoundException $e) {
9797
$this->fail($event, $request, new BadCredentialsException(sprintf('Username %s not found.', $digestAuth->getUsername())));
9898

9999
return;

Firewall/RememberMeListener.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,12 @@ public function handle(GetResponseEvent $event)
8080
if (null !== $this->logger) {
8181
$this->logger->debug('SecurityContext populated with remember-me token.');
8282
}
83-
} catch (AuthenticationException $failed) {
83+
} catch (AuthenticationException $e) {
8484
if (null !== $this->logger) {
8585
$this->logger->warning(
8686
'SecurityContext not populated with remember-me token as the'
8787
.' AuthenticationManager rejected the AuthenticationToken returned'
88-
.' by the RememberMeServices: '.$failed->getMessage()
88+
.' by the RememberMeServices: '.$e->getMessage()
8989
);
9090
}
9191

RememberMe/AbstractRememberMeServices.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,21 +123,21 @@ final public function autoLogin(Request $request)
123123
}
124124

125125
return new RememberMeToken($user, $this->providerKey, $this->key);
126-
} catch (CookieTheftException $theft) {
126+
} catch (CookieTheftException $e) {
127127
$this->cancelCookie($request);
128128

129-
throw $theft;
130-
} catch (UsernameNotFoundException $notFound) {
129+
throw $e;
130+
} catch (UsernameNotFoundException $e) {
131131
if (null !== $this->logger) {
132132
$this->logger->info('User for remember-me cookie not found.');
133133
}
134-
} catch (UnsupportedUserException $unSupported) {
134+
} catch (UnsupportedUserException $e) {
135135
if (null !== $this->logger) {
136136
$this->logger->warning('User class for remember-me cookie not supported.');
137137
}
138-
} catch (AuthenticationException $invalid) {
138+
} catch (AuthenticationException $e) {
139139
if (null !== $this->logger) {
140-
$this->logger->debug('Remember-Me authentication failed: '.$invalid->getMessage());
140+
$this->logger->debug('Remember-Me authentication failed: '.$e->getMessage());
141141
}
142142
}
143143

RememberMe/TokenBasedRememberMeServices.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ protected function processAutoLoginCookie(array $cookieParts, Request $request)
4141
}
4242
try {
4343
$user = $this->getUserProvider($class)->loadUserByUsername($username);
44-
} catch (\Exception $ex) {
45-
if (!$ex instanceof AuthenticationException) {
46-
$ex = new AuthenticationException($ex->getMessage(), $ex->getCode(), $ex);
44+
} catch (\Exception $e) {
45+
if (!$e instanceof AuthenticationException) {
46+
$e = new AuthenticationException($e->getMessage(), $e->getCode(), $e);
4747
}
4848

49-
throw $ex;
49+
throw $e;
5050
}
5151

5252
if (!$user instanceof UserInterface) {

0 commit comments

Comments
 (0)