Skip to content

Commit 44d7fe4

Browse files
committed
Use short array deconstruction syntax.
1 parent 8a3077e commit 44d7fe4

File tree

7 files changed

+28
-28
lines changed

7 files changed

+28
-28
lines changed

Firewall/ChannelListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function __construct(AccessMapInterface $map, AuthenticationEntryPointInt
4545
*/
4646
public function supports(Request $request): ?bool
4747
{
48-
list(, $channel) = $this->map->getPatterns($request);
48+
[, $channel] = $this->map->getPatterns($request);
4949

5050
if ('https' === $channel && !$request->isSecure()) {
5151
if (null !== $this->logger) {

Logout/LogoutUrlGenerator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public function setCurrentFirewall($key, $context = null)
9292
*/
9393
private function generateLogoutUrl(?string $key, int $referenceType): string
9494
{
95-
list($logoutPath, $csrfTokenId, $csrfParameter, $csrfTokenManager) = $this->getListener($key);
95+
[$logoutPath, $csrfTokenId, $csrfParameter, $csrfTokenManager] = $this->getListener($key);
9696

9797
if (null === $logoutPath) {
9898
throw new \LogicException('Unable to generate the logout URL without a path.');
@@ -154,7 +154,7 @@ private function getListener(?string $key): array
154154
}
155155

156156
// Fetch from injected current firewall information, if possible
157-
list($key, $context) = $this->currentFirewall;
157+
[$key, $context] = $this->currentFirewall;
158158

159159
if (isset($this->listeners[$key])) {
160160
return $this->listeners[$key];

RememberMe/PersistentTokenBasedRememberMeServices.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ protected function cancelCookie(Request $request)
4949
if (null !== ($cookie = $request->cookies->get($this->options['name']))
5050
&& 2 === \count($parts = $this->decodeCookie($cookie))
5151
) {
52-
list($series) = $parts;
52+
[$series] = $parts;
5353
$this->tokenProvider->deleteTokenBySeries($series);
5454
}
5555
}
@@ -63,7 +63,7 @@ protected function processAutoLoginCookie(array $cookieParts, Request $request)
6363
throw new AuthenticationException('The cookie is invalid.');
6464
}
6565

66-
list($series, $tokenValue) = $cookieParts;
66+
[$series, $tokenValue] = $cookieParts;
6767
$persistentToken = $this->tokenProvider->loadTokenBySeries($series);
6868

6969
if (!hash_equals($persistentToken->getTokenValue(), $tokenValue)) {

RememberMe/TokenBasedRememberMeServices.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ protected function processAutoLoginCookie(array $cookieParts, Request $request)
3535
throw new AuthenticationException('The cookie is invalid.');
3636
}
3737

38-
list($class, $username, $expires, $hash) = $cookieParts;
38+
[$class, $username, $expires, $hash] = $cookieParts;
3939
if (false === $username = base64_decode($username, true)) {
4040
throw new AuthenticationException('$username contains a character from outside the base64 alphabet.');
4141
}

Tests/Firewall/LogoutListenerTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ class LogoutListenerTest extends TestCase
2121
{
2222
public function testHandleUnmatchedPath()
2323
{
24-
list($listener, , $httpUtils, $options) = $this->getListener();
24+
[$listener, , $httpUtils, $options] = $this->getListener();
2525

26-
list($event, $request) = $this->getGetResponseEvent();
26+
[$event, $request] = $this->getGetResponseEvent();
2727

2828
$event->expects($this->never())
2929
->method('setResponse');
@@ -41,9 +41,9 @@ public function testHandleMatchedPathWithSuccessHandlerAndCsrfValidation()
4141
$successHandler = $this->getSuccessHandler();
4242
$tokenManager = $this->getTokenManager();
4343

44-
list($listener, $tokenStorage, $httpUtils, $options) = $this->getListener($successHandler, $tokenManager);
44+
[$listener, $tokenStorage, $httpUtils, $options] = $this->getListener($successHandler, $tokenManager);
4545

46-
list($event, $request) = $this->getGetResponseEvent();
46+
[$event, $request] = $this->getGetResponseEvent();
4747

4848
$request->query->set('_csrf_token', 'token');
4949

@@ -87,9 +87,9 @@ public function testHandleMatchedPathWithoutSuccessHandlerAndCsrfValidation()
8787
{
8888
$successHandler = $this->getSuccessHandler();
8989

90-
list($listener, $tokenStorage, $httpUtils, $options) = $this->getListener($successHandler);
90+
[$listener, $tokenStorage, $httpUtils, $options] = $this->getListener($successHandler);
9191

92-
list($event, $request) = $this->getGetResponseEvent();
92+
[$event, $request] = $this->getGetResponseEvent();
9393

9494
$httpUtils->expects($this->once())
9595
->method('checkRequestPath')
@@ -128,9 +128,9 @@ public function testSuccessHandlerReturnsNonResponse()
128128
$this->expectException('RuntimeException');
129129
$successHandler = $this->getSuccessHandler();
130130

131-
list($listener, , $httpUtils, $options) = $this->getListener($successHandler);
131+
[$listener, , $httpUtils, $options] = $this->getListener($successHandler);
132132

133-
list($event, $request) = $this->getGetResponseEvent();
133+
[$event, $request] = $this->getGetResponseEvent();
134134

135135
$httpUtils->expects($this->once())
136136
->method('checkRequestPath')
@@ -150,9 +150,9 @@ public function testCsrfValidationFails()
150150
$this->expectException('Symfony\Component\Security\Core\Exception\LogoutException');
151151
$tokenManager = $this->getTokenManager();
152152

153-
list($listener, , $httpUtils, $options) = $this->getListener(null, $tokenManager);
153+
[$listener, , $httpUtils, $options] = $this->getListener(null, $tokenManager);
154154

155-
list($event, $request) = $this->getGetResponseEvent();
155+
[$event, $request] = $this->getGetResponseEvent();
156156

157157
$request->query->set('_csrf_token', 'token');
158158

Tests/Firewall/RememberMeListenerTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class RememberMeListenerTest extends TestCase
2525
{
2626
public function testOnCoreSecurityDoesNotTryToPopulateNonEmptyTokenStorage()
2727
{
28-
list($listener, $tokenStorage) = $this->getListener();
28+
[$listener, $tokenStorage] = $this->getListener();
2929

3030
$tokenStorage
3131
->expects($this->any())
@@ -43,7 +43,7 @@ public function testOnCoreSecurityDoesNotTryToPopulateNonEmptyTokenStorage()
4343

4444
public function testOnCoreSecurityDoesNothingWhenNoCookieIsSet()
4545
{
46-
list($listener, $tokenStorage, $service) = $this->getListener();
46+
[$listener, $tokenStorage, $service] = $this->getListener();
4747

4848
$tokenStorage
4949
->expects($this->any())
@@ -64,7 +64,7 @@ public function testOnCoreSecurityDoesNothingWhenNoCookieIsSet()
6464

6565
public function testOnCoreSecurityIgnoresAuthenticationExceptionThrownByAuthenticationManagerImplementation()
6666
{
67-
list($listener, $tokenStorage, $service, $manager) = $this->getListener();
67+
[$listener, $tokenStorage, $service, $manager] = $this->getListener();
6868
$request = new Request();
6969
$exception = new AuthenticationException('Authentication failed.');
7070

@@ -101,7 +101,7 @@ public function testOnCoreSecurityIgnoresAuthenticationOptionallyRethrowsExcepti
101101
{
102102
$this->expectException('Symfony\Component\Security\Core\Exception\AuthenticationException');
103103
$this->expectExceptionMessage('Authentication failed.');
104-
list($listener, $tokenStorage, $service, $manager) = $this->getListener(false, false);
104+
[$listener, $tokenStorage, $service, $manager] = $this->getListener(false, false);
105105

106106
$tokenStorage
107107
->expects($this->any())
@@ -134,7 +134,7 @@ public function testOnCoreSecurityIgnoresAuthenticationOptionallyRethrowsExcepti
134134

135135
public function testOnCoreSecurityAuthenticationExceptionDuringAutoLoginTriggersLoginFail()
136136
{
137-
list($listener, $tokenStorage, $service, $manager) = $this->getListener();
137+
[$listener, $tokenStorage, $service, $manager] = $this->getListener();
138138

139139
$tokenStorage
140140
->expects($this->any())
@@ -166,7 +166,7 @@ public function testOnCoreSecurityAuthenticationExceptionDuringAutoLoginTriggers
166166

167167
public function testOnCoreSecurity()
168168
{
169-
list($listener, $tokenStorage, $service, $manager) = $this->getListener();
169+
[$listener, $tokenStorage, $service, $manager] = $this->getListener();
170170

171171
$tokenStorage
172172
->expects($this->any())
@@ -200,7 +200,7 @@ public function testOnCoreSecurity()
200200

201201
public function testSessionStrategy()
202202
{
203-
list($listener, $tokenStorage, $service, $manager, , , $sessionStrategy) = $this->getListener(false, true, true);
203+
[$listener, $tokenStorage, $service, $manager, , , $sessionStrategy] = $this->getListener(false, true, true);
204204

205205
$tokenStorage
206206
->expects($this->any())
@@ -250,7 +250,7 @@ public function testSessionStrategy()
250250

251251
public function testSessionIsMigratedByDefault()
252252
{
253-
list($listener, $tokenStorage, $service, $manager) = $this->getListener(false, true, false);
253+
[$listener, $tokenStorage, $service, $manager] = $this->getListener(false, true, false);
254254

255255
$tokenStorage
256256
->expects($this->any())
@@ -298,7 +298,7 @@ public function testSessionIsMigratedByDefault()
298298

299299
public function testOnCoreSecurityInteractiveLoginEventIsDispatchedIfDispatcherIsPresent()
300300
{
301-
list($listener, $tokenStorage, $service, $manager, , $dispatcher) = $this->getListener(true);
301+
[$listener, $tokenStorage, $service, $manager, , $dispatcher] = $this->getListener(true);
302302

303303
$tokenStorage
304304
->expects($this->any())

Tests/FirewallMapTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function testGetListeners()
5353

5454
$map->add($tooLateMatcher, [function () {}]);
5555

56-
list($listeners, $exception) = $map->getListeners($request);
56+
[$listeners, $exception] = $map->getListeners($request);
5757

5858
$this->assertEquals([$theListener], $listeners);
5959
$this->assertEquals($theException, $exception);
@@ -88,7 +88,7 @@ public function testGetListenersWithAnEntryHavingNoRequestMatcher()
8888

8989
$map->add($tooLateMatcher, [function () {}]);
9090

91-
list($listeners, $exception) = $map->getListeners($request);
91+
[$listeners, $exception] = $map->getListeners($request);
9292

9393
$this->assertEquals([$theListener], $listeners);
9494
$this->assertEquals($theException, $exception);
@@ -110,7 +110,7 @@ public function testGetListenersWithNoMatchingEntry()
110110

111111
$map->add($notMatchingMatcher, [function () {}]);
112112

113-
list($listeners, $exception) = $map->getListeners($request);
113+
[$listeners, $exception] = $map->getListeners($request);
114114

115115
$this->assertEquals([], $listeners);
116116
$this->assertNull($exception);

0 commit comments

Comments
 (0)