Skip to content

Commit cf23b8d

Browse files
committed
Merge branch '4.2' into short-array-master
* 4.2: fixed CS fixed CS fixed tests fixed CS fixed CS fixed CS fixed short array CS in comments fixed CS in ExpressionLanguage fixtures fixed CS in generated files fixed CS on generated container files fixed CS on Form PHP templates fixed CS on YAML fixtures fixed fixtures switched array() to []
2 parents 35f3ea2 + b564efb commit cf23b8d

File tree

56 files changed

+469
-469
lines changed

Some content is hidden

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

56 files changed

+469
-469
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
@@ -59,7 +59,7 @@ public function onAuthenticationSuccess(Request $request, TokenInterface $token)
5959
{
6060
if ($this->simpleAuthenticator instanceof AuthenticationSuccessHandlerInterface) {
6161
if ($this->logger) {
62-
$this->logger->debug('Selected an authentication success handler.', array('handler' => \get_class($this->simpleAuthenticator)));
62+
$this->logger->debug('Selected an authentication success handler.', ['handler' => \get_class($this->simpleAuthenticator)]);
6363
}
6464

6565
$response = $this->simpleAuthenticator->onAuthenticationSuccess($request, $token);
@@ -86,7 +86,7 @@ public function onAuthenticationFailure(Request $request, AuthenticationExceptio
8686
{
8787
if ($this->simpleAuthenticator instanceof AuthenticationFailureHandlerInterface) {
8888
if ($this->logger) {
89-
$this->logger->debug('Selected an authentication failure handler.', array('handler' => \get_class($this->simpleAuthenticator)));
89+
$this->logger->debug('Selected an authentication failure handler.', ['handler' => \get_class($this->simpleAuthenticator)]);
9090
}
9191

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

Firewall.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,10 @@ public function onKernelFinishRequest(FinishRequestEvent $event)
105105
*/
106106
public static function getSubscribedEvents()
107107
{
108-
return array(
109-
KernelEvents::REQUEST => array('onKernelRequest', 8),
108+
return [
109+
KernelEvents::REQUEST => ['onKernelRequest', 8],
110110
KernelEvents::FINISH_REQUEST => 'onKernelFinishRequest',
111-
);
111+
];
112112
}
113113

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

Firewall/AbstractAuthenticationListener.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ abstract class AbstractAuthenticationListener implements ListenerInterface
6666
/**
6767
* @throws \InvalidArgumentException
6868
*/
69-
public function __construct(TokenStorageInterface $tokenStorage, AuthenticationManagerInterface $authenticationManager, SessionAuthenticationStrategyInterface $sessionStrategy, HttpUtils $httpUtils, string $providerKey, AuthenticationSuccessHandlerInterface $successHandler, AuthenticationFailureHandlerInterface $failureHandler, array $options = array(), LoggerInterface $logger = null, EventDispatcherInterface $dispatcher = null)
69+
public function __construct(TokenStorageInterface $tokenStorage, AuthenticationManagerInterface $authenticationManager, SessionAuthenticationStrategyInterface $sessionStrategy, HttpUtils $httpUtils, string $providerKey, AuthenticationSuccessHandlerInterface $successHandler, AuthenticationFailureHandlerInterface $failureHandler, array $options = [], LoggerInterface $logger = null, EventDispatcherInterface $dispatcher = null)
7070
{
7171
if (empty($providerKey)) {
7272
throw new \InvalidArgumentException('$providerKey must not be empty.');
@@ -78,7 +78,7 @@ public function __construct(TokenStorageInterface $tokenStorage, AuthenticationM
7878
$this->providerKey = $providerKey;
7979
$this->successHandler = $successHandler;
8080
$this->failureHandler = $failureHandler;
81-
$this->options = array_merge(array(
81+
$this->options = array_merge([
8282
'check_path' => '/login_check',
8383
'login_path' => '/login',
8484
'always_use_default_target_path' => false,
@@ -88,7 +88,7 @@ public function __construct(TokenStorageInterface $tokenStorage, AuthenticationM
8888
'failure_path' => null,
8989
'failure_forward' => false,
9090
'require_previous_session' => true,
91-
), $options);
91+
], $options);
9292
$this->logger = $logger;
9393
$this->dispatcher = $dispatcher;
9494
$this->httpUtils = $httpUtils;
@@ -171,7 +171,7 @@ abstract protected function attemptAuthentication(Request $request);
171171
private function onFailure(Request $request, AuthenticationException $failed)
172172
{
173173
if (null !== $this->logger) {
174-
$this->logger->info('Authentication request failed.', array('exception' => $failed));
174+
$this->logger->info('Authentication request failed.', ['exception' => $failed]);
175175
}
176176

177177
$token = $this->tokenStorage->getToken();
@@ -191,7 +191,7 @@ private function onFailure(Request $request, AuthenticationException $failed)
191191
private function onSuccess(Request $request, TokenInterface $token)
192192
{
193193
if (null !== $this->logger) {
194-
$this->logger->info('User has been authenticated successfully.', array('username' => $token->getUsername()));
194+
$this->logger->info('User has been authenticated successfully.', ['username' => $token->getUsername()]);
195195
}
196196

197197
$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
}
@@ -178,7 +178,7 @@ protected function refreshUser(TokenInterface $token)
178178
$userDeauthenticated = true;
179179

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

184184
continue;
@@ -187,7 +187,7 @@ protected function refreshUser(TokenInterface $token)
187187
$token->setUser($refreshedUser);
188188

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

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

210210
$userNotFoundByProvider = true;
@@ -230,7 +230,7 @@ private function safelyUnserialize($serializedToken)
230230
{
231231
$e = $token = null;
232232
$prevUnserializeHandler = ini_set('unserialize_callback_func', __CLASS__.'::handleUnserializeCallback');
233-
$prevErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = array()) use (&$prevErrorHandler) {
233+
$prevErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = []) use (&$prevErrorHandler) {
234234
if (__FILE__ === $file) {
235235
throw new \ErrorException($msg, 0x37313bc, $type, $file, $line);
236236
}
@@ -249,7 +249,7 @@ private function safelyUnserialize($serializedToken)
249249
throw $e;
250250
}
251251
if ($this->logger) {
252-
$this->logger->warning('Failed to unserialize the security token from the session.', array('key' => $this->sessionKey, 'received' => $serializedToken, 'exception' => $e));
252+
$this->logger->warning('Failed to unserialize the security token from the session.', ['key' => $this->sessionKey, 'received' => $serializedToken, 'exception' => $e]);
253253
}
254254
}
255255

0 commit comments

Comments
 (0)