Skip to content

Commit 894e699

Browse files
committed
Leverage non-capturing catches
1 parent 16c12d0 commit 894e699

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

Firewall/ContextListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ protected function refreshUser(TokenInterface $token): ?TokenInterface
234234
}
235235

236236
return $token;
237-
} catch (UnsupportedUserException $e) {
237+
} catch (UnsupportedUserException) {
238238
// let's try the next user provider
239239
} catch (UserNotFoundException $e) {
240240
$this->logger?->warning('Username could not be found in the selected user provider.', ['username' => $e->getUserIdentifier(), 'provider' => \get_class($provider)]);

Firewall/ExceptionListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ private function startAuthentication(Request $request, AuthenticationException $
204204

205205
try {
206206
$response = $this->authenticationEntryPoint->start($request, $authException);
207-
} catch (NotAnEntryPointException $e) {
207+
} catch (NotAnEntryPointException) {
208208
$this->throwUnauthorizedException($authException);
209209
}
210210

Firewall/SwitchUserListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ private function attemptSwitchUser(Request $request, string $username): ?TokenIn
158158

159159
try {
160160
$this->provider->loadUserByIdentifier($nonExistentUsername);
161-
} catch (\Exception $e) {
161+
} catch (\Exception) {
162162
}
163163
} catch (AuthenticationException $e) {
164164
$this->provider->loadUserByIdentifier($currentUsername);

HttpUtils.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ public function checkRequestPath(Request $request, string $path): bool
119119
}
120120

121121
return isset($parameters['_route']) && $path === $parameters['_route'];
122-
} catch (MethodNotAllowedException $e) {
122+
} catch (MethodNotAllowedException) {
123123
return false;
124-
} catch (ResourceNotFoundException $e) {
124+
} catch (ResourceNotFoundException) {
125125
return false;
126126
}
127127
}

ParameterBagUtils.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public static function getParameterBagValue(ParameterBag $parameters, string $pa
4848

4949
try {
5050
return self::$propertyAccessor->getValue($value, substr($path, $pos));
51-
} catch (AccessException $e) {
51+
} catch (AccessException) {
5252
return null;
5353
}
5454
}
@@ -76,7 +76,7 @@ public static function getRequestParameterValue(Request $request, string $path):
7676

7777
try {
7878
return self::$propertyAccessor->getValue($value, substr($path, $pos));
79-
} catch (AccessException $e) {
79+
} catch (AccessException) {
8080
return null;
8181
}
8282
}

0 commit comments

Comments
 (0)