Skip to content

Commit dcd6b69

Browse files
committed
switched array() to []
1 parent b5678b2 commit dcd6b69

File tree

86 files changed

+1148
-1148
lines changed

Some content is hidden

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

86 files changed

+1148
-1148
lines changed

Command/SetAclCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
125125
}
126126

127127
// Parse arguments
128-
$objectIdentities = array();
128+
$objectIdentities = [];
129129
$maskBuilder = $this->getMaskBuilder();
130130
foreach ($input->getArgument('arguments') as $argument) {
131131
$data = explode(':', $argument, 2);
@@ -149,7 +149,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
149149
}
150150

151151
// Create security identities
152-
$securityIdentities = array();
152+
$securityIdentities = [];
153153

154154
if ($userOption) {
155155
foreach ($userOption as $user) {

Command/UserPasswordEncoderCommand.php

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

42-
public function __construct(EncoderFactoryInterface $encoderFactory = null, array $userClasses = array())
42+
public function __construct(EncoderFactoryInterface $encoderFactory = null, array $userClasses = [])
4343
{
4444
if (null === $encoderFactory) {
4545
@trigger_error(sprintf('Passing null as the first argument of "%s()" is deprecated since Symfony 3.3 and support for it will be removed in 4.0. If the command was registered by convention, make it a service instead.', __METHOD__), E_USER_DEPRECATED);
@@ -152,14 +152,14 @@ protected function execute(InputInterface $input, OutputInterface $output)
152152

153153
$encodedPassword = $encoder->encodePassword($password, $salt);
154154

155-
$rows = array(
156-
array('Encoder used', \get_class($encoder)),
157-
array('Encoded password', $encodedPassword),
158-
);
155+
$rows = [
156+
['Encoder used', \get_class($encoder)],
157+
['Encoded password', $encodedPassword],
158+
];
159159
if (!$emptySalt) {
160-
$rows[] = array('Generated salt', $salt);
160+
$rows[] = ['Generated salt', $salt];
161161
}
162-
$io->table(array('Key', 'Value'), $rows);
162+
$io->table(['Key', 'Value'], $rows);
163163

164164
if (!$emptySalt) {
165165
$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;
@@ -127,7 +127,7 @@ public function collect(Request $request, Response $response, \Exception $except
127127
return $role->getRole();
128128
};
129129

130-
$this->data = array(
130+
$this->data = [
131131
'enabled' => true,
132132
'authenticated' => $token->isAuthenticated(),
133133
'impersonated' => null !== $impersonatorUser,
@@ -140,7 +140,7 @@ public function collect(Request $request, Response $response, \Exception $except
140140
'roles' => array_map($extractRoles, $assignedRoles),
141141
'inherited_roles' => array_unique(array_map($extractRoles, $inheritedRoles)),
142142
'supports_role_hierarchy' => null !== $this->roleHierarchy,
143-
);
143+
];
144144
}
145145

146146
// collect voters and access decision manager information
@@ -152,17 +152,17 @@ public function collect(Request $request, Response $response, \Exception $except
152152
$this->data['voters'][] = $this->hasVarDumper ? new ClassStub(\get_class($voter)) : \get_class($voter);
153153
}
154154
} else {
155-
$this->data['access_decision_log'] = array();
155+
$this->data['access_decision_log'] = [];
156156
$this->data['voter_strategy'] = 'unknown';
157-
$this->data['voters'] = array();
157+
$this->data['voters'] = [];
158158
}
159159

160160
// collect firewall context information
161161
$this->data['firewall'] = null;
162162
if ($this->firewallMap instanceof FirewallMap) {
163163
$firewallConfig = $this->firewallMap->getFirewallConfig($request);
164164
if (null !== $firewallConfig) {
165-
$this->data['firewall'] = array(
165+
$this->data['firewall'] = [
166166
'name' => $firewallConfig->getName(),
167167
'allows_anonymous' => $firewallConfig->allowsAnonymous(),
168168
'request_matcher' => $firewallConfig->getRequestMatcher(),
@@ -175,7 +175,7 @@ public function collect(Request $request, Response $response, \Exception $except
175175
'access_denied_url' => $firewallConfig->getAccessDeniedUrl(),
176176
'user_checker' => $firewallConfig->getUserChecker(),
177177
'listeners' => $firewallConfig->getListeners(),
178-
);
178+
];
179179

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

191191
// collect firewall listeners information
192-
$this->data['listeners'] = array();
192+
$this->data['listeners'] = [];
193193
if ($this->firewall) {
194194
$this->data['listeners'] = $this->firewall->getWrappedListeners();
195195
}
@@ -200,7 +200,7 @@ public function collect(Request $request, Response $response, \Exception $except
200200
*/
201201
public function reset()
202202
{
203-
$this->data = array();
203+
$this->data = [];
204204
}
205205

206206
public function lateCollect()

Debug/WrappedListener.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function handle(GetResponseEvent $event)
5353
*/
5454
public function __call($method, $arguments)
5555
{
56-
return \call_user_func_array(array($this->listener, $method), $arguments);
56+
return \call_user_func_array([$this->listener, $method], $arguments);
5757
}
5858

5959
public function getWrappedListener()
@@ -67,10 +67,10 @@ public function getInfo()
6767
$this->stub = self::$hasVarDumper ? new ClassStub(\get_class($this->listener)) : \get_class($this->listener);
6868
}
6969

70-
return array(
70+
return [
7171
'response' => $this->response,
7272
'time' => $this->time,
7373
'stub' => $this->stub,
74-
);
74+
];
7575
}
7676
}

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
@@ -74,7 +74,7 @@ public function getConfigTreeBuilder()
7474
->children()
7575
->scalarNode('access_denied_url')->defaultNull()->example('/foo/error403')->end()
7676
->enumNode('session_fixation_strategy')
77-
->values(array(SessionAuthenticationStrategy::NONE, SessionAuthenticationStrategy::MIGRATE, SessionAuthenticationStrategy::INVALIDATE))
77+
->values([SessionAuthenticationStrategy::NONE, SessionAuthenticationStrategy::MIGRATE, SessionAuthenticationStrategy::INVALIDATE])
7878
->defaultValue(SessionAuthenticationStrategy::MIGRATE)
7979
->end()
8080
->booleanNode('hide_user_not_found')->defaultTrue()->end()
@@ -84,7 +84,7 @@ public function getConfigTreeBuilder()
8484
->addDefaultsIfNotSet()
8585
->children()
8686
->enumNode('strategy')
87-
->values(array(AccessDecisionManager::STRATEGY_AFFIRMATIVE, AccessDecisionManager::STRATEGY_CONSENSUS, AccessDecisionManager::STRATEGY_UNANIMOUS))
87+
->values([AccessDecisionManager::STRATEGY_AFFIRMATIVE, AccessDecisionManager::STRATEGY_CONSENSUS, AccessDecisionManager::STRATEGY_UNANIMOUS])
8888
->end()
8989
->scalarNode('service')->end()
9090
->booleanNode('allow_if_all_abstain')->defaultFalse()->end()
@@ -158,7 +158,7 @@ private function addRoleHierarchySection(ArrayNodeDefinition $rootNode)
158158
->useAttributeAsKey('id')
159159
->prototype('array')
160160
->performNoDeepMerging()
161-
->beforeNormalization()->ifString()->then(function ($v) { return array('value' => $v); })->end()
161+
->beforeNormalization()->ifString()->then(function ($v) { return ['value' => $v]; })->end()
162162
->beforeNormalization()
163163
->ifTrue(function ($v) { return \is_array($v) && isset($v['value']); })
164164
->then(function ($v) { return preg_split('/\s*,\s*/', $v['value']); })
@@ -189,7 +189,7 @@ private function addAccessControlSection(ArrayNodeDefinition $rootNode)
189189
->end()
190190
->scalarNode('host')->defaultNull()->end()
191191
->arrayNode('ips')
192-
->beforeNormalization()->ifString()->then(function ($v) { return array($v); })->end()
192+
->beforeNormalization()->ifString()->then(function ($v) { return [$v]; })->end()
193193
->prototype('scalar')->end()
194194
->end()
195195
->arrayNode('methods')
@@ -250,7 +250,7 @@ private function addFirewallsSection(ArrayNodeDefinition $rootNode, array $facto
250250
->info('When true, it will trigger a logout for the user if something has changed. This will be the default behavior as of Syfmony 4.0.')
251251
->end()
252252
->arrayNode('logout')
253-
->treatTrueLike(array())
253+
->treatTrueLike([])
254254
->canBeUnset()
255255
->children()
256256
->scalarNode('csrf_parameter')->defaultValue('_csrf_token')->end()
@@ -266,7 +266,7 @@ private function addFirewallsSection(ArrayNodeDefinition $rootNode, array $facto
266266
->arrayNode('delete_cookies')
267267
->beforeNormalization()
268268
->ifTrue(function ($v) { return \is_array($v) && \is_int(key($v)); })
269-
->then(function ($v) { return array_map(function ($v) { return array('name' => $v); }, $v); })
269+
->then(function ($v) { return array_map(function ($v) { return ['name' => $v]; }, $v); })
270270
->end()
271271
->useAttributeAsKey('name')
272272
->prototype('array')
@@ -301,7 +301,7 @@ private function addFirewallsSection(ArrayNodeDefinition $rootNode, array $facto
301301
->end()
302302
;
303303

304-
$abstractFactoryKeys = array();
304+
$abstractFactoryKeys = [];
305305
foreach ($factories as $factoriesAtPosition) {
306306
foreach ($factoriesAtPosition as $factory) {
307307
$name = str_replace('-', '_', $factory->getKey());
@@ -347,17 +347,17 @@ private function addProvidersSection(ArrayNodeDefinition $rootNode)
347347
->fixXmlConfig('provider')
348348
->children()
349349
->arrayNode('providers')
350-
->example(array(
351-
'my_memory_provider' => array(
352-
'memory' => array(
353-
'users' => array(
354-
'foo' => array('password' => 'foo', 'roles' => 'ROLE_USER'),
355-
'bar' => array('password' => 'bar', 'roles' => '[ROLE_USER, ROLE_ADMIN]'),
356-
),
357-
),
358-
),
359-
'my_entity_provider' => array('entity' => array('class' => 'SecurityBundle:User', 'property' => 'username')),
360-
))
350+
->example([
351+
'my_memory_provider' => [
352+
'memory' => [
353+
'users' => [
354+
'foo' => ['password' => 'foo', 'roles' => 'ROLE_USER'],
355+
'bar' => ['password' => 'bar', 'roles' => '[ROLE_USER, ROLE_ADMIN]'],
356+
],
357+
],
358+
],
359+
'my_entity_provider' => ['entity' => ['class' => 'SecurityBundle:User', 'property' => 'username']],
360+
])
361361
->isRequired()
362362
->requiresAtLeastOneElement()
363363
->useAttributeAsKey('name')
@@ -407,19 +407,19 @@ private function addEncodersSection(ArrayNodeDefinition $rootNode)
407407
->fixXmlConfig('encoder')
408408
->children()
409409
->arrayNode('encoders')
410-
->example(array(
410+
->example([
411411
'App\Entity\User1' => 'bcrypt',
412-
'App\Entity\User2' => array(
412+
'App\Entity\User2' => [
413413
'algorithm' => 'bcrypt',
414414
'cost' => 13,
415-
),
416-
))
415+
],
416+
])
417417
->requiresAtLeastOneElement()
418418
->useAttributeAsKey('class')
419419
->prototype('array')
420420
->canBeUnset()
421421
->performNoDeepMerging()
422-
->beforeNormalization()->ifString()->then(function ($v) { return array('algorithm' => $v); })->end()
422+
->beforeNormalization()->ifString()->then(function ($v) { return ['algorithm' => $v]; })->end()
423423
->children()
424424
->scalarNode('algorithm')->cannotBeEmpty()->end()
425425
->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;

0 commit comments

Comments
 (0)