Skip to content

Commit 252ac05

Browse files
derrabusnicolas-grekas
authored andcommitted
Fix inconsistent return points.
1 parent ff1e2fe commit 252ac05

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

Firewall/ExceptionListener.php

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,21 @@ public function onKernelException(GetResponseForExceptionEvent $event)
9090
$exception = $event->getException();
9191
do {
9292
if ($exception instanceof AuthenticationException) {
93-
return $this->handleAuthenticationException($event, $exception);
94-
} elseif ($exception instanceof AccessDeniedException) {
95-
return $this->handleAccessDeniedException($event, $exception);
96-
} elseif ($exception instanceof LogoutException) {
97-
return $this->handleLogoutException($exception);
93+
$this->handleAuthenticationException($event, $exception);
94+
95+
return;
96+
}
97+
98+
if ($exception instanceof AccessDeniedException) {
99+
$this->handleAccessDeniedException($event, $exception);
100+
101+
return;
102+
}
103+
104+
if ($exception instanceof LogoutException) {
105+
$this->handleLogoutException($exception);
106+
107+
return;
98108
}
99109
} while (null !== $exception = $exception->getPrevious());
100110
}

Firewall/UsernamePasswordJsonAuthenticationListener.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ public function handle(GetResponseEvent $event)
135135
$event->setResponse($response);
136136
}
137137

138+
/**
139+
* @return Response|null
140+
*/
138141
private function onSuccess(Request $request, TokenInterface $token)
139142
{
140143
if (null !== $this->logger) {
@@ -151,7 +154,7 @@ private function onSuccess(Request $request, TokenInterface $token)
151154
}
152155

153156
if (!$this->successHandler) {
154-
return; // let the original request succeeds
157+
return null; // let the original request succeeds
155158
}
156159

157160
$response = $this->successHandler->onAuthenticationSuccess($request, $token);

RememberMe/AbstractRememberMeServices.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ final public function autoLogin(Request $request)
148148

149149
throw $e;
150150
}
151+
152+
return null;
151153
}
152154

153155
/**

0 commit comments

Comments
 (0)