Skip to content

Commit ef9cb05

Browse files
committed
switched array() to []
1 parent e3dc131 commit ef9cb05

File tree

57 files changed

+472
-472
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+472
-472
lines changed

AccessMap.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@
2222
*/
2323
class AccessMap implements AccessMapInterface
2424
{
25-
private $map = array();
25+
private $map = [];
2626

2727
/**
2828
* @param RequestMatcherInterface $requestMatcher A RequestMatcherInterface instance
2929
* @param array $attributes An array of attributes to pass to the access decision manager (like roles)
3030
* @param string|null $channel The channel to enforce (http, https, or null)
3131
*/
32-
public function add(RequestMatcherInterface $requestMatcher, array $attributes = array(), $channel = null)
32+
public function add(RequestMatcherInterface $requestMatcher, array $attributes = [], $channel = null)
3333
{
34-
$this->map[] = array($requestMatcher, $attributes, $channel);
34+
$this->map[] = [$requestMatcher, $attributes, $channel];
3535
}
3636

3737
/**
@@ -41,10 +41,10 @@ public function getPatterns(Request $request)
4141
{
4242
foreach ($this->map as $elements) {
4343
if (null === $elements[0] || $elements[0]->matches($request)) {
44-
return array($elements[1], $elements[2]);
44+
return [$elements[1], $elements[2]];
4545
}
4646
}
4747

48-
return array(null, null);
48+
return [null, null];
4949
}
5050
}

Authentication/DefaultAuthenticationFailureHandler.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ class DefaultAuthenticationFailureHandler implements AuthenticationFailureHandle
3535
protected $httpUtils;
3636
protected $logger;
3737
protected $options;
38-
protected $defaultOptions = array(
38+
protected $defaultOptions = [
3939
'failure_path' => null,
4040
'failure_forward' => false,
4141
'login_path' => '/login',
4242
'failure_path_parameter' => '_failure_path',
43-
);
43+
];
4444

45-
public function __construct(HttpKernelInterface $httpKernel, HttpUtils $httpUtils, array $options = array(), LoggerInterface $logger = null)
45+
public function __construct(HttpKernelInterface $httpKernel, HttpUtils $httpUtils, array $options = [], LoggerInterface $logger = null)
4646
{
4747
$this->httpKernel = $httpKernel;
4848
$this->httpUtils = $httpUtils;
@@ -80,7 +80,7 @@ public function onAuthenticationFailure(Request $request, AuthenticationExceptio
8080

8181
if ($this->options['failure_forward']) {
8282
if (null !== $this->logger) {
83-
$this->logger->debug('Authentication failure, forward triggered.', array('failure_path' => $this->options['failure_path']));
83+
$this->logger->debug('Authentication failure, forward triggered.', ['failure_path' => $this->options['failure_path']]);
8484
}
8585

8686
$subRequest = $this->httpUtils->createRequest($request, $this->options['failure_path']);
@@ -90,7 +90,7 @@ public function onAuthenticationFailure(Request $request, AuthenticationExceptio
9090
}
9191

9292
if (null !== $this->logger) {
93-
$this->logger->debug('Authentication failure, redirect triggered.', array('failure_path' => $this->options['failure_path']));
93+
$this->logger->debug('Authentication failure, redirect triggered.', ['failure_path' => $this->options['failure_path']]);
9494
}
9595

9696
$request->getSession()->set(Security::AUTHENTICATION_ERROR, $exception);

Authentication/DefaultAuthenticationSuccessHandler.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,19 @@ class DefaultAuthenticationSuccessHandler implements AuthenticationSuccessHandle
3131
protected $httpUtils;
3232
protected $options;
3333
protected $providerKey;
34-
protected $defaultOptions = array(
34+
protected $defaultOptions = [
3535
'always_use_default_target_path' => false,
3636
'default_target_path' => '/',
3737
'login_path' => '/login',
3838
'target_path_parameter' => '_target_path',
3939
'use_referer' => false,
40-
);
40+
];
4141

4242
/**
4343
* @param HttpUtils $httpUtils
4444
* @param array $options Options for processing a successful authentication attempt
4545
*/
46-
public function __construct(HttpUtils $httpUtils, array $options = array())
46+
public function __construct(HttpUtils $httpUtils, array $options = [])
4747
{
4848
$this->httpUtils = $httpUtils;
4949
$this->setOptions($options);

Authentication/SimpleAuthenticationHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function onAuthenticationSuccess(Request $request, TokenInterface $token)
5555
{
5656
if ($this->simpleAuthenticator instanceof AuthenticationSuccessHandlerInterface) {
5757
if ($this->logger) {
58-
$this->logger->debug('Selected an authentication success handler.', array('handler' => \get_class($this->simpleAuthenticator)));
58+
$this->logger->debug('Selected an authentication success handler.', ['handler' => \get_class($this->simpleAuthenticator)]);
5959
}
6060

6161
$response = $this->simpleAuthenticator->onAuthenticationSuccess($request, $token);
@@ -82,7 +82,7 @@ public function onAuthenticationFailure(Request $request, AuthenticationExceptio
8282
{
8383
if ($this->simpleAuthenticator instanceof AuthenticationFailureHandlerInterface) {
8484
if ($this->logger) {
85-
$this->logger->debug('Selected an authentication failure handler.', array('handler' => \get_class($this->simpleAuthenticator)));
85+
$this->logger->debug('Selected an authentication failure handler.', ['handler' => \get_class($this->simpleAuthenticator)]);
8686
}
8787

8888
$response = $this->simpleAuthenticator->onAuthenticationFailure($request, $exception);

EntryPoint/DigestAuthenticationEntryPoint.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function start(Request $request, AuthenticationException $authException =
5858
}
5959

6060
if (null !== $this->logger) {
61-
$this->logger->debug('WWW-Authenticate header sent.', array('header' => $authenticateHeader));
61+
$this->logger->debug('WWW-Authenticate header sent.', ['header' => $authenticateHeader]);
6262
}
6363

6464
$response = new Response();

Firewall.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,10 @@ public function onKernelFinishRequest(FinishRequestEvent $event)
9999
*/
100100
public static function getSubscribedEvents()
101101
{
102-
return array(
103-
KernelEvents::REQUEST => array('onKernelRequest', 8),
102+
return [
103+
KernelEvents::REQUEST => ['onKernelRequest', 8],
104104
KernelEvents::FINISH_REQUEST => 'onKernelFinishRequest',
105-
);
105+
];
106106
}
107107

108108
protected function handleRequest(GetResponseEvent $event, $listeners)

Firewall/AbstractAuthenticationListener.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ abstract class AbstractAuthenticationListener implements ListenerInterface
7878
*
7979
* @throws \InvalidArgumentException
8080
*/
81-
public function __construct(TokenStorageInterface $tokenStorage, AuthenticationManagerInterface $authenticationManager, SessionAuthenticationStrategyInterface $sessionStrategy, HttpUtils $httpUtils, $providerKey, AuthenticationSuccessHandlerInterface $successHandler, AuthenticationFailureHandlerInterface $failureHandler, array $options = array(), LoggerInterface $logger = null, EventDispatcherInterface $dispatcher = null)
81+
public function __construct(TokenStorageInterface $tokenStorage, AuthenticationManagerInterface $authenticationManager, SessionAuthenticationStrategyInterface $sessionStrategy, HttpUtils $httpUtils, $providerKey, AuthenticationSuccessHandlerInterface $successHandler, AuthenticationFailureHandlerInterface $failureHandler, array $options = [], LoggerInterface $logger = null, EventDispatcherInterface $dispatcher = null)
8282
{
8383
if (empty($providerKey)) {
8484
throw new \InvalidArgumentException('$providerKey must not be empty.');
@@ -90,7 +90,7 @@ public function __construct(TokenStorageInterface $tokenStorage, AuthenticationM
9090
$this->providerKey = $providerKey;
9191
$this->successHandler = $successHandler;
9292
$this->failureHandler = $failureHandler;
93-
$this->options = array_merge(array(
93+
$this->options = array_merge([
9494
'check_path' => '/login_check',
9595
'login_path' => '/login',
9696
'always_use_default_target_path' => false,
@@ -100,7 +100,7 @@ public function __construct(TokenStorageInterface $tokenStorage, AuthenticationM
100100
'failure_path' => null,
101101
'failure_forward' => false,
102102
'require_previous_session' => true,
103-
), $options);
103+
], $options);
104104
$this->logger = $logger;
105105
$this->dispatcher = $dispatcher;
106106
$this->httpUtils = $httpUtils;
@@ -183,7 +183,7 @@ abstract protected function attemptAuthentication(Request $request);
183183
private function onFailure(Request $request, AuthenticationException $failed)
184184
{
185185
if (null !== $this->logger) {
186-
$this->logger->info('Authentication request failed.', array('exception' => $failed));
186+
$this->logger->info('Authentication request failed.', ['exception' => $failed]);
187187
}
188188

189189
$token = $this->tokenStorage->getToken();
@@ -203,7 +203,7 @@ private function onFailure(Request $request, AuthenticationException $failed)
203203
private function onSuccess(Request $request, TokenInterface $token)
204204
{
205205
if (null !== $this->logger) {
206-
$this->logger->info('User has been authenticated successfully.', array('username' => $token->getUsername()));
206+
$this->logger->info('User has been authenticated successfully.', ['username' => $token->getUsername()]);
207207
}
208208

209209
$this->tokenStorage->setToken($token);

Firewall/AbstractPreAuthenticatedListener.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ final public function handle(GetResponseEvent $event)
6666
}
6767

6868
if (null !== $this->logger) {
69-
$this->logger->debug('Checking current security token.', array('token' => (string) $this->tokenStorage->getToken()));
69+
$this->logger->debug('Checking current security token.', ['token' => (string) $this->tokenStorage->getToken()]);
7070
}
7171

7272
if (null !== $token = $this->tokenStorage->getToken()) {
@@ -76,14 +76,14 @@ final public function handle(GetResponseEvent $event)
7676
}
7777

7878
if (null !== $this->logger) {
79-
$this->logger->debug('Trying to pre-authenticate user.', array('username' => (string) $user));
79+
$this->logger->debug('Trying to pre-authenticate user.', ['username' => (string) $user]);
8080
}
8181

8282
try {
8383
$token = $this->authenticationManager->authenticate(new PreAuthenticatedToken($user, $credentials, $this->providerKey));
8484

8585
if (null !== $this->logger) {
86-
$this->logger->info('Pre-authentication successful.', array('token' => (string) $token));
86+
$this->logger->info('Pre-authentication successful.', ['token' => (string) $token]);
8787
}
8888

8989
$this->migrateSession($request, $token);
@@ -119,7 +119,7 @@ private function clearToken(AuthenticationException $exception)
119119
$this->tokenStorage->setToken(null);
120120

121121
if (null !== $this->logger) {
122-
$this->logger->info('Cleared security token due to an exception.', array('exception' => $exception));
122+
$this->logger->info('Cleared security token due to an exception.', ['exception' => $exception]);
123123
}
124124
}
125125
}

Firewall/AnonymousAuthenticationListener.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function handle(GetResponseEvent $event)
4949
}
5050

5151
try {
52-
$token = new AnonymousToken($this->secret, 'anon.', array());
52+
$token = new AnonymousToken($this->secret, 'anon.', []);
5353
if (null !== $this->authenticationManager) {
5454
$token = $this->authenticationManager->authenticate($token);
5555
}
@@ -61,7 +61,7 @@ public function handle(GetResponseEvent $event)
6161
}
6262
} catch (AuthenticationException $failed) {
6363
if (null !== $this->logger) {
64-
$this->logger->info('Anonymous authentication failed.', array('exception' => $failed));
64+
$this->logger->info('Anonymous authentication failed.', ['exception' => $failed]);
6565
}
6666
}
6767
}

Firewall/BasicAuthenticationListener.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function handle(GetResponseEvent $event)
6969
}
7070

7171
if (null !== $this->logger) {
72-
$this->logger->info('Basic authentication Authorization header found for user.', array('username' => $username));
72+
$this->logger->info('Basic authentication Authorization header found for user.', ['username' => $username]);
7373
}
7474

7575
try {
@@ -85,7 +85,7 @@ public function handle(GetResponseEvent $event)
8585
}
8686

8787
if (null !== $this->logger) {
88-
$this->logger->info('Basic authentication failed for user.', array('username' => $username, 'exception' => $e));
88+
$this->logger->info('Basic authentication failed for user.', ['username' => $username, 'exception' => $e]);
8989
}
9090

9191
if ($this->ignoreFailure) {

Firewall/ContextListener.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function setLogoutOnUserChange($logoutOnUserChange)
7979
public function handle(GetResponseEvent $event)
8080
{
8181
if (!$this->registered && null !== $this->dispatcher && $event->isMasterRequest()) {
82-
$this->dispatcher->addListener(KernelEvents::RESPONSE, array($this, 'onKernelResponse'));
82+
$this->dispatcher->addListener(KernelEvents::RESPONSE, [$this, 'onKernelResponse']);
8383
$this->registered = true;
8484
}
8585

@@ -95,17 +95,17 @@ public function handle(GetResponseEvent $event)
9595
$token = $this->safelyUnserialize($token);
9696

9797
if (null !== $this->logger) {
98-
$this->logger->debug('Read existing security token from the session.', array(
98+
$this->logger->debug('Read existing security token from the session.', [
9999
'key' => $this->sessionKey,
100100
'token_class' => \is_object($token) ? \get_class($token) : null,
101-
));
101+
]);
102102
}
103103

104104
if ($token instanceof TokenInterface) {
105105
$token = $this->refreshUser($token);
106106
} elseif (null !== $token) {
107107
if (null !== $this->logger) {
108-
$this->logger->warning('Expected a security token from the session, got something else.', array('key' => $this->sessionKey, 'received' => $token));
108+
$this->logger->warning('Expected a security token from the session, got something else.', ['key' => $this->sessionKey, 'received' => $token]);
109109
}
110110

111111
$token = null;
@@ -129,7 +129,7 @@ public function onKernelResponse(FilterResponseEvent $event)
129129
return;
130130
}
131131

132-
$this->dispatcher->removeListener(KernelEvents::RESPONSE, array($this, 'onKernelResponse'));
132+
$this->dispatcher->removeListener(KernelEvents::RESPONSE, [$this, 'onKernelResponse']);
133133
$this->registered = false;
134134
$session = $request->getSession();
135135

@@ -141,7 +141,7 @@ public function onKernelResponse(FilterResponseEvent $event)
141141
$session->set($this->sessionKey, serialize($token));
142142

143143
if (null !== $this->logger) {
144-
$this->logger->debug('Stored the security token in the session.', array('key' => $this->sessionKey));
144+
$this->logger->debug('Stored the security token in the session.', ['key' => $this->sessionKey]);
145145
}
146146
}
147147
}
@@ -179,7 +179,7 @@ protected function refreshUser(TokenInterface $token)
179179
$userDeauthenticated = true;
180180

181181
if (null !== $this->logger) {
182-
$this->logger->debug('Cannot refresh token because user has changed.', array('username' => $refreshedUser->getUsername(), 'provider' => \get_class($provider)));
182+
$this->logger->debug('Cannot refresh token because user has changed.', ['username' => $refreshedUser->getUsername(), 'provider' => \get_class($provider)]);
183183
}
184184

185185
continue;
@@ -191,7 +191,7 @@ protected function refreshUser(TokenInterface $token)
191191
$token->setUser($refreshedUser);
192192

193193
if (null !== $this->logger) {
194-
$context = array('provider' => \get_class($provider), 'username' => $refreshedUser->getUsername());
194+
$context = ['provider' => \get_class($provider), 'username' => $refreshedUser->getUsername()];
195195

196196
foreach ($token->getRoles() as $role) {
197197
if ($role instanceof SwitchUserRole) {
@@ -208,7 +208,7 @@ protected function refreshUser(TokenInterface $token)
208208
// let's try the next user provider
209209
} catch (UsernameNotFoundException $e) {
210210
if (null !== $this->logger) {
211-
$this->logger->warning('Username could not be found in the selected user provider.', array('username' => $e->getUsername(), 'provider' => \get_class($provider)));
211+
$this->logger->warning('Username could not be found in the selected user provider.', ['username' => $e->getUsername(), 'provider' => \get_class($provider)]);
212212
}
213213

214214
$userNotFoundByProvider = true;
@@ -234,7 +234,7 @@ private function safelyUnserialize($serializedToken)
234234
{
235235
$e = $token = null;
236236
$prevUnserializeHandler = ini_set('unserialize_callback_func', __CLASS__.'::handleUnserializeCallback');
237-
$prevErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = array()) use (&$prevErrorHandler) {
237+
$prevErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = []) use (&$prevErrorHandler) {
238238
if (__FILE__ === $file) {
239239
throw new \UnexpectedValueException($msg, 0x37313bc);
240240
}
@@ -254,7 +254,7 @@ private function safelyUnserialize($serializedToken)
254254
throw $e;
255255
}
256256
if ($this->logger) {
257-
$this->logger->warning('Failed to unserialize the security token from the session.', array('key' => $this->sessionKey, 'received' => $serializedToken, 'exception' => $e));
257+
$this->logger->warning('Failed to unserialize the security token from the session.', ['key' => $this->sessionKey, 'received' => $serializedToken, 'exception' => $e]);
258258
}
259259
}
260260

0 commit comments

Comments
 (0)