Skip to content

Commit 5dd6131

Browse files
committed
Merge branch '4.1' into 4.2
* 4.1: 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 404bb89 + 6161cf2 commit 5dd6131

File tree

75 files changed

+696
-696
lines changed

Some content is hidden

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

75 files changed

+696
-696
lines changed

CacheWarmer/ExpressionCacheWarmer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function isOptional()
3737
public function warmUp($cacheDir)
3838
{
3939
foreach ($this->expressions as $expression) {
40-
$this->expressionLanguage->parse($expression, array('token', 'user', 'object', 'subject', 'roles', 'request', 'trust_resolver'));
40+
$this->expressionLanguage->parse($expression, ['token', 'user', 'object', 'subject', 'roles', 'request', 'trust_resolver']);
4141
}
4242
}
4343
}

Command/UserPasswordEncoderCommand.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class UserPasswordEncoderCommand extends Command
3838
private $encoderFactory;
3939
private $userClasses;
4040

41-
public function __construct(EncoderFactoryInterface $encoderFactory, array $userClasses = array())
41+
public function __construct(EncoderFactoryInterface $encoderFactory, array $userClasses = [])
4242
{
4343
$this->encoderFactory = $encoderFactory;
4444
$this->userClasses = $userClasses;
@@ -146,14 +146,14 @@ protected function execute(InputInterface $input, OutputInterface $output)
146146

147147
$encodedPassword = $encoder->encodePassword($password, $salt);
148148

149-
$rows = array(
150-
array('Encoder used', \get_class($encoder)),
151-
array('Encoded password', $encodedPassword),
152-
);
149+
$rows = [
150+
['Encoder used', \get_class($encoder)],
151+
['Encoded password', $encodedPassword],
152+
];
153153
if (!$emptySalt) {
154-
$rows[] = array('Generated salt', $salt);
154+
$rows[] = ['Generated salt', $salt];
155155
}
156-
$io->table(array('Key', 'Value'), $rows);
156+
$io->table(['Key', 'Value'], $rows);
157157

158158
if (!$emptySalt) {
159159
$errorIo->note(sprintf('Make sure that your salt storage field fits the salt length: %s chars', \strlen($salt)));

DataCollector/SecurityDataCollector.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function __construct(TokenStorageInterface $tokenStorage = null, RoleHier
6060
public function collect(Request $request, Response $response, \Exception $exception = null)
6161
{
6262
if (null === $this->tokenStorage) {
63-
$this->data = array(
63+
$this->data = [
6464
'enabled' => false,
6565
'authenticated' => false,
6666
'impersonated' => false,
@@ -70,12 +70,12 @@ public function collect(Request $request, Response $response, \Exception $except
7070
'token_class' => null,
7171
'logout_url' => null,
7272
'user' => '',
73-
'roles' => array(),
74-
'inherited_roles' => array(),
73+
'roles' => [],
74+
'inherited_roles' => [],
7575
'supports_role_hierarchy' => null !== $this->roleHierarchy,
76-
);
76+
];
7777
} elseif (null === $token = $this->tokenStorage->getToken()) {
78-
$this->data = array(
78+
$this->data = [
7979
'enabled' => true,
8080
'authenticated' => false,
8181
'impersonated' => false,
@@ -85,12 +85,12 @@ public function collect(Request $request, Response $response, \Exception $except
8585
'token_class' => null,
8686
'logout_url' => null,
8787
'user' => '',
88-
'roles' => array(),
89-
'inherited_roles' => array(),
88+
'roles' => [],
89+
'inherited_roles' => [],
9090
'supports_role_hierarchy' => null !== $this->roleHierarchy,
91-
);
91+
];
9292
} else {
93-
$inheritedRoles = array();
93+
$inheritedRoles = [];
9494
$assignedRoles = $token->getRoles();
9595

9696
$impersonatorUser = null;
@@ -119,7 +119,7 @@ public function collect(Request $request, Response $response, \Exception $except
119119
// fail silently when the logout URL cannot be generated
120120
}
121121

122-
$this->data = array(
122+
$this->data = [
123123
'enabled' => true,
124124
'authenticated' => $token->isAuthenticated(),
125125
'impersonated' => null !== $impersonatorUser,
@@ -132,7 +132,7 @@ public function collect(Request $request, Response $response, \Exception $except
132132
'roles' => array_map(function (Role $role) { return $role->getRole(); }, $assignedRoles),
133133
'inherited_roles' => array_unique(array_map(function (Role $role) { return $role->getRole(); }, $inheritedRoles)),
134134
'supports_role_hierarchy' => null !== $this->roleHierarchy,
135-
);
135+
];
136136
}
137137

138138
// collect voters and access decision manager information
@@ -165,17 +165,17 @@ public function collect(Request $request, Response $response, \Exception $except
165165

166166
$this->data['access_decision_log'] = $decisionLog;
167167
} else {
168-
$this->data['access_decision_log'] = array();
168+
$this->data['access_decision_log'] = [];
169169
$this->data['voter_strategy'] = 'unknown';
170-
$this->data['voters'] = array();
170+
$this->data['voters'] = [];
171171
}
172172

173173
// collect firewall context information
174174
$this->data['firewall'] = null;
175175
if ($this->firewallMap instanceof FirewallMap) {
176176
$firewallConfig = $this->firewallMap->getFirewallConfig($request);
177177
if (null !== $firewallConfig) {
178-
$this->data['firewall'] = array(
178+
$this->data['firewall'] = [
179179
'name' => $firewallConfig->getName(),
180180
'allows_anonymous' => $firewallConfig->allowsAnonymous(),
181181
'request_matcher' => $firewallConfig->getRequestMatcher(),
@@ -188,7 +188,7 @@ public function collect(Request $request, Response $response, \Exception $except
188188
'access_denied_url' => $firewallConfig->getAccessDeniedUrl(),
189189
'user_checker' => $firewallConfig->getUserChecker(),
190190
'listeners' => $firewallConfig->getListeners(),
191-
);
191+
];
192192

193193
// generate exit impersonation path from current request
194194
if ($this->data['impersonated'] && null !== $switchUserConfig = $firewallConfig->getSwitchUser()) {
@@ -202,7 +202,7 @@ public function collect(Request $request, Response $response, \Exception $except
202202
}
203203

204204
// collect firewall listeners information
205-
$this->data['listeners'] = array();
205+
$this->data['listeners'] = [];
206206
if ($this->firewall) {
207207
$this->data['listeners'] = $this->firewall->getWrappedListeners();
208208
}
@@ -213,7 +213,7 @@ public function collect(Request $request, Response $response, \Exception $except
213213
*/
214214
public function reset()
215215
{
216-
$this->data = array();
216+
$this->data = [];
217217
}
218218

219219
public function lateCollect()

DependencyInjection/Compiler/RegisterCsrfTokenClearingLogoutHandlerPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ public function process(ContainerBuilder $container)
3737
->addArgument(new Reference('security.csrf.token_storage'))
3838
->setPublic(false);
3939

40-
$container->findDefinition('security.logout_listener')->addMethodCall('addHandler', array(new Reference('security.logout.handler.csrf_token_clearing')));
40+
$container->findDefinition('security.logout_listener')->addMethodCall('addHandler', [new Reference('security.logout.handler.csrf_token_clearing')]);
4141
}
4242
}

DependencyInjection/MainConfiguration.php

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function getConfigTreeBuilder()
6868
->children()
6969
->scalarNode('access_denied_url')->defaultNull()->example('/foo/error403')->end()
7070
->enumNode('session_fixation_strategy')
71-
->values(array(SessionAuthenticationStrategy::NONE, SessionAuthenticationStrategy::MIGRATE, SessionAuthenticationStrategy::INVALIDATE))
71+
->values([SessionAuthenticationStrategy::NONE, SessionAuthenticationStrategy::MIGRATE, SessionAuthenticationStrategy::INVALIDATE])
7272
->defaultValue(SessionAuthenticationStrategy::MIGRATE)
7373
->end()
7474
->booleanNode('hide_user_not_found')->defaultTrue()->end()
@@ -78,7 +78,7 @@ public function getConfigTreeBuilder()
7878
->addDefaultsIfNotSet()
7979
->children()
8080
->enumNode('strategy')
81-
->values(array(AccessDecisionManager::STRATEGY_AFFIRMATIVE, AccessDecisionManager::STRATEGY_CONSENSUS, AccessDecisionManager::STRATEGY_UNANIMOUS))
81+
->values([AccessDecisionManager::STRATEGY_AFFIRMATIVE, AccessDecisionManager::STRATEGY_CONSENSUS, AccessDecisionManager::STRATEGY_UNANIMOUS])
8282
->end()
8383
->scalarNode('service')->end()
8484
->booleanNode('allow_if_all_abstain')->defaultFalse()->end()
@@ -110,7 +110,7 @@ private function addRoleHierarchySection(ArrayNodeDefinition $rootNode)
110110
->useAttributeAsKey('id')
111111
->prototype('array')
112112
->performNoDeepMerging()
113-
->beforeNormalization()->ifString()->then(function ($v) { return array('value' => $v); })->end()
113+
->beforeNormalization()->ifString()->then(function ($v) { return ['value' => $v]; })->end()
114114
->beforeNormalization()
115115
->ifTrue(function ($v) { return \is_array($v) && isset($v['value']); })
116116
->then(function ($v) { return preg_split('/\s*,\s*/', $v['value']); })
@@ -142,7 +142,7 @@ private function addAccessControlSection(ArrayNodeDefinition $rootNode)
142142
->scalarNode('host')->defaultNull()->end()
143143
->integerNode('port')->defaultNull()->end()
144144
->arrayNode('ips')
145-
->beforeNormalization()->ifString()->then(function ($v) { return array($v); })->end()
145+
->beforeNormalization()->ifString()->then(function ($v) { return [$v]; })->end()
146146
->prototype('scalar')->end()
147147
->end()
148148
->arrayNode('methods')
@@ -204,7 +204,7 @@ private function addFirewallsSection(ArrayNodeDefinition $rootNode, array $facto
204204
->setDeprecated('The "%path%.%node%" configuration key has been deprecated in Symfony 4.1.')
205205
->end()
206206
->arrayNode('logout')
207-
->treatTrueLike(array())
207+
->treatTrueLike([])
208208
->canBeUnset()
209209
->children()
210210
->scalarNode('csrf_parameter')->defaultValue('_csrf_token')->end()
@@ -220,7 +220,7 @@ private function addFirewallsSection(ArrayNodeDefinition $rootNode, array $facto
220220
->arrayNode('delete_cookies')
221221
->beforeNormalization()
222222
->ifTrue(function ($v) { return \is_array($v) && \is_int(key($v)); })
223-
->then(function ($v) { return array_map(function ($v) { return array('name' => $v); }, $v); })
223+
->then(function ($v) { return array_map(function ($v) { return ['name' => $v]; }, $v); })
224224
->end()
225225
->useAttributeAsKey('name')
226226
->prototype('array')
@@ -258,7 +258,7 @@ private function addFirewallsSection(ArrayNodeDefinition $rootNode, array $facto
258258
->end()
259259
;
260260

261-
$abstractFactoryKeys = array();
261+
$abstractFactoryKeys = [];
262262
foreach ($factories as $factoriesAtPosition) {
263263
foreach ($factoriesAtPosition as $factory) {
264264
$name = str_replace('-', '_', $factory->getKey());
@@ -308,17 +308,17 @@ private function addProvidersSection(ArrayNodeDefinition $rootNode)
308308
->fixXmlConfig('provider')
309309
->children()
310310
->arrayNode('providers')
311-
->example(array(
312-
'my_memory_provider' => array(
313-
'memory' => array(
314-
'users' => array(
315-
'foo' => array('password' => 'foo', 'roles' => 'ROLE_USER'),
316-
'bar' => array('password' => 'bar', 'roles' => '[ROLE_USER, ROLE_ADMIN]'),
317-
),
318-
),
319-
),
320-
'my_entity_provider' => array('entity' => array('class' => 'SecurityBundle:User', 'property' => 'username')),
321-
))
311+
->example([
312+
'my_memory_provider' => [
313+
'memory' => [
314+
'users' => [
315+
'foo' => ['password' => 'foo', 'roles' => 'ROLE_USER'],
316+
'bar' => ['password' => 'bar', 'roles' => '[ROLE_USER, ROLE_ADMIN]'],
317+
],
318+
],
319+
],
320+
'my_entity_provider' => ['entity' => ['class' => 'SecurityBundle:User', 'property' => 'username']],
321+
])
322322
->requiresAtLeastOneElement()
323323
->useAttributeAsKey('name')
324324
->prototype('array')
@@ -367,19 +367,19 @@ private function addEncodersSection(ArrayNodeDefinition $rootNode)
367367
->fixXmlConfig('encoder')
368368
->children()
369369
->arrayNode('encoders')
370-
->example(array(
370+
->example([
371371
'App\Entity\User1' => 'bcrypt',
372-
'App\Entity\User2' => array(
372+
'App\Entity\User2' => [
373373
'algorithm' => 'bcrypt',
374374
'cost' => 13,
375-
),
376-
))
375+
],
376+
])
377377
->requiresAtLeastOneElement()
378378
->useAttributeAsKey('class')
379379
->prototype('array')
380380
->canBeUnset()
381381
->performNoDeepMerging()
382-
->beforeNormalization()->ifString()->then(function ($v) { return array('algorithm' => $v); })->end()
382+
->beforeNormalization()->ifString()->then(function ($v) { return ['algorithm' => $v]; })->end()
383383
->children()
384384
->scalarNode('algorithm')->cannotBeEmpty()->end()
385385
->scalarNode('hash_algorithm')->info('Name of hashing algorithm for PBKDF2 (i.e. sha256, sha512, etc..) See hash_algos() for a list of supported algorithms.')->defaultValue('sha512')->end()

DependencyInjection/Security/Factory/AbstractFactory.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,26 @@
2626
*/
2727
abstract class AbstractFactory implements SecurityFactoryInterface
2828
{
29-
protected $options = array(
29+
protected $options = [
3030
'check_path' => '/login_check',
3131
'use_forward' => false,
3232
'require_previous_session' => false,
33-
);
33+
];
3434

35-
protected $defaultSuccessHandlerOptions = array(
35+
protected $defaultSuccessHandlerOptions = [
3636
'always_use_default_target_path' => false,
3737
'default_target_path' => '/',
3838
'login_path' => '/login',
3939
'target_path_parameter' => '_target_path',
4040
'use_referer' => false,
41-
);
41+
];
4242

43-
protected $defaultFailureHandlerOptions = array(
43+
protected $defaultFailureHandlerOptions = [
4444
'failure_path' => null,
4545
'failure_forward' => false,
4646
'login_path' => '/login',
4747
'failure_path_parameter' => '_failure_path',
48-
);
48+
];
4949

5050
public function create(ContainerBuilder $container, $id, $config, $userProviderId, $defaultEntryPointId)
5151
{
@@ -59,14 +59,14 @@ public function create(ContainerBuilder $container, $id, $config, $userProviderI
5959
if ($this->isRememberMeAware($config)) {
6060
$container
6161
->getDefinition($listenerId)
62-
->addTag('security.remember_me_aware', array('id' => $id, 'provider' => $userProviderId))
62+
->addTag('security.remember_me_aware', ['id' => $id, 'provider' => $userProviderId])
6363
;
6464
}
6565

6666
// create entry point if applicable (optional)
6767
$entryPointId = $this->createEntryPoint($container, $id, $config, $defaultEntryPointId);
6868

69-
return array($authProviderId, $listenerId, $entryPointId);
69+
return [$authProviderId, $listenerId, $entryPointId];
7070
}
7171

7272
public function addConfiguration(NodeDefinition $node)
@@ -178,8 +178,8 @@ protected function createAuthenticationSuccessHandler($container, $id, $config)
178178
$successHandler->replaceArgument(2, $id);
179179
} else {
180180
$successHandler = $container->setDefinition($successHandlerId, new ChildDefinition('security.authentication.success_handler'));
181-
$successHandler->addMethodCall('setOptions', array($options));
182-
$successHandler->addMethodCall('setProviderKey', array($id));
181+
$successHandler->addMethodCall('setOptions', [$options]);
182+
$successHandler->addMethodCall('setProviderKey', [$id]);
183183
}
184184

185185
return $successHandlerId;
@@ -196,7 +196,7 @@ protected function createAuthenticationFailureHandler($container, $id, $config)
196196
$failureHandler->replaceArgument(1, $options);
197197
} else {
198198
$failureHandler = $container->setDefinition($id, new ChildDefinition('security.authentication.failure_handler'));
199-
$failureHandler->addMethodCall('setOptions', array($options));
199+
$failureHandler->addMethodCall('setOptions', [$options]);
200200
}
201201

202202
return $id;

DependencyInjection/Security/Factory/FormLoginLdapFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ protected function createAuthProvider(ContainerBuilder $container, $id, $config,
3737
;
3838

3939
if (!empty($config['query_string'])) {
40-
$definition->addMethodCall('setQueryString', array($config['query_string']));
40+
$definition->addMethodCall('setQueryString', [$config['query_string']]);
4141
}
4242

4343
return $provider;

DependencyInjection/Security/Factory/GuardAuthenticationFactory.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function addConfiguration(NodeDefinition $node)
5858
public function create(ContainerBuilder $container, $id, $config, $userProvider, $defaultEntryPoint)
5959
{
6060
$authenticatorIds = $config['authenticators'];
61-
$authenticatorReferences = array();
61+
$authenticatorReferences = [];
6262
foreach ($authenticatorIds as $authenticatorId) {
6363
$authenticatorReferences[] = new Reference($authenticatorId);
6464
}
@@ -87,9 +87,9 @@ public function create(ContainerBuilder $container, $id, $config, $userProvider,
8787
// this is always injected - then the listener decides if it should be used
8888
$container
8989
->getDefinition($listenerId)
90-
->addTag('security.remember_me_aware', array('id' => $id, 'provider' => $userProvider));
90+
->addTag('security.remember_me_aware', ['id' => $id, 'provider' => $userProvider]);
9191

92-
return array($providerId, $listenerId, $entryPointId);
92+
return [$providerId, $listenerId, $entryPointId];
9393
}
9494

9595
private function determineEntryPoint($defaultEntryPointId, array $config)

DependencyInjection/Security/Factory/HttpBasicFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ public function create(ContainerBuilder $container, $id, $config, $userProvider,
4141
$listener = $container->setDefinition($listenerId, new ChildDefinition('security.authentication.listener.basic'));
4242
$listener->replaceArgument(2, $id);
4343
$listener->replaceArgument(3, new Reference($entryPointId));
44-
$listener->addMethodCall('setSessionAuthenticationStrategy', array(new Reference('security.authentication.session_strategy.'.$id)));
44+
$listener->addMethodCall('setSessionAuthenticationStrategy', [new Reference('security.authentication.session_strategy.'.$id)]);
4545

46-
return array($provider, $listenerId, $entryPointId);
46+
return [$provider, $listenerId, $entryPointId];
4747
}
4848

4949
public function getPosition()

0 commit comments

Comments
 (0)