Skip to content

Commit 6161cf2

Browse files
committed
fixed CS
1 parent 4ec4750 commit 6161cf2

27 files changed

+622
-622
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
@@ -59,7 +59,7 @@ public function __construct(TokenStorageInterface $tokenStorage = null, RoleHier
5959
public function collect(Request $request, Response $response, \Exception $exception = null)
6060
{
6161
if (null === $this->tokenStorage) {
62-
$this->data = array(
62+
$this->data = [
6363
'enabled' => false,
6464
'authenticated' => false,
6565
'impersonated' => false,
@@ -69,12 +69,12 @@ public function collect(Request $request, Response $response, \Exception $except
6969
'token_class' => null,
7070
'logout_url' => null,
7171
'user' => '',
72-
'roles' => array(),
73-
'inherited_roles' => array(),
72+
'roles' => [],
73+
'inherited_roles' => [],
7474
'supports_role_hierarchy' => null !== $this->roleHierarchy,
75-
);
75+
];
7676
} elseif (null === $token = $this->tokenStorage->getToken()) {
77-
$this->data = array(
77+
$this->data = [
7878
'enabled' => true,
7979
'authenticated' => false,
8080
'impersonated' => false,
@@ -84,12 +84,12 @@ public function collect(Request $request, Response $response, \Exception $except
8484
'token_class' => null,
8585
'logout_url' => null,
8686
'user' => '',
87-
'roles' => array(),
88-
'inherited_roles' => array(),
87+
'roles' => [],
88+
'inherited_roles' => [],
8989
'supports_role_hierarchy' => null !== $this->roleHierarchy,
90-
);
90+
];
9191
} else {
92-
$inheritedRoles = array();
92+
$inheritedRoles = [];
9393
$assignedRoles = $token->getRoles();
9494

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

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

137137
// collect voters and access decision manager information
@@ -143,17 +143,17 @@ public function collect(Request $request, Response $response, \Exception $except
143143
$this->data['voters'][] = $this->hasVarDumper ? new ClassStub(\get_class($voter)) : \get_class($voter);
144144
}
145145
} else {
146-
$this->data['access_decision_log'] = array();
146+
$this->data['access_decision_log'] = [];
147147
$this->data['voter_strategy'] = 'unknown';
148-
$this->data['voters'] = array();
148+
$this->data['voters'] = [];
149149
}
150150

151151
// collect firewall context information
152152
$this->data['firewall'] = null;
153153
if ($this->firewallMap instanceof FirewallMap) {
154154
$firewallConfig = $this->firewallMap->getFirewallConfig($request);
155155
if (null !== $firewallConfig) {
156-
$this->data['firewall'] = array(
156+
$this->data['firewall'] = [
157157
'name' => $firewallConfig->getName(),
158158
'allows_anonymous' => $firewallConfig->allowsAnonymous(),
159159
'request_matcher' => $firewallConfig->getRequestMatcher(),
@@ -166,7 +166,7 @@ public function collect(Request $request, Response $response, \Exception $except
166166
'access_denied_url' => $firewallConfig->getAccessDeniedUrl(),
167167
'user_checker' => $firewallConfig->getUserChecker(),
168168
'listeners' => $firewallConfig->getListeners(),
169-
);
169+
];
170170

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

182182
// collect firewall listeners information
183-
$this->data['listeners'] = array();
183+
$this->data['listeners'] = [];
184184
if ($this->firewall) {
185185
$this->data['listeners'] = $this->firewall->getWrappedListeners();
186186
}
@@ -191,7 +191,7 @@ public function collect(Request $request, Response $response, \Exception $except
191191
*/
192192
public function reset()
193193
{
194-
$this->data = array();
194+
$this->data = [];
195195
}
196196

197197
public function lateCollect()

DependencyInjection/MainConfiguration.php

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function getConfigTreeBuilder()
6666
->children()
6767
->scalarNode('access_denied_url')->defaultNull()->example('/foo/error403')->end()
6868
->enumNode('session_fixation_strategy')
69-
->values(array(SessionAuthenticationStrategy::NONE, SessionAuthenticationStrategy::MIGRATE, SessionAuthenticationStrategy::INVALIDATE))
69+
->values([SessionAuthenticationStrategy::NONE, SessionAuthenticationStrategy::MIGRATE, SessionAuthenticationStrategy::INVALIDATE])
7070
->defaultValue(SessionAuthenticationStrategy::MIGRATE)
7171
->end()
7272
->booleanNode('hide_user_not_found')->defaultTrue()->end()
@@ -76,7 +76,7 @@ public function getConfigTreeBuilder()
7676
->addDefaultsIfNotSet()
7777
->children()
7878
->enumNode('strategy')
79-
->values(array(AccessDecisionManager::STRATEGY_AFFIRMATIVE, AccessDecisionManager::STRATEGY_CONSENSUS, AccessDecisionManager::STRATEGY_UNANIMOUS))
79+
->values([AccessDecisionManager::STRATEGY_AFFIRMATIVE, AccessDecisionManager::STRATEGY_CONSENSUS, AccessDecisionManager::STRATEGY_UNANIMOUS])
8080
->end()
8181
->scalarNode('service')->end()
8282
->booleanNode('allow_if_all_abstain')->defaultFalse()->end()
@@ -108,7 +108,7 @@ private function addRoleHierarchySection(ArrayNodeDefinition $rootNode)
108108
->useAttributeAsKey('id')
109109
->prototype('array')
110110
->performNoDeepMerging()
111-
->beforeNormalization()->ifString()->then(function ($v) { return array('value' => $v); })->end()
111+
->beforeNormalization()->ifString()->then(function ($v) { return ['value' => $v]; })->end()
112112
->beforeNormalization()
113113
->ifTrue(function ($v) { return \is_array($v) && isset($v['value']); })
114114
->then(function ($v) { return preg_split('/\s*,\s*/', $v['value']); })
@@ -139,7 +139,7 @@ private function addAccessControlSection(ArrayNodeDefinition $rootNode)
139139
->end()
140140
->scalarNode('host')->defaultNull()->end()
141141
->arrayNode('ips')
142-
->beforeNormalization()->ifString()->then(function ($v) { return array($v); })->end()
142+
->beforeNormalization()->ifString()->then(function ($v) { return [$v]; })->end()
143143
->prototype('scalar')->end()
144144
->end()
145145
->arrayNode('methods')
@@ -201,7 +201,7 @@ private function addFirewallsSection(ArrayNodeDefinition $rootNode, array $facto
201201
->setDeprecated('The "%path%.%node%" configuration key has been deprecated in Symfony 4.1.')
202202
->end()
203203
->arrayNode('logout')
204-
->treatTrueLike(array())
204+
->treatTrueLike([])
205205
->canBeUnset()
206206
->children()
207207
->scalarNode('csrf_parameter')->defaultValue('_csrf_token')->end()
@@ -217,7 +217,7 @@ private function addFirewallsSection(ArrayNodeDefinition $rootNode, array $facto
217217
->arrayNode('delete_cookies')
218218
->beforeNormalization()
219219
->ifTrue(function ($v) { return \is_array($v) && \is_int(key($v)); })
220-
->then(function ($v) { return array_map(function ($v) { return array('name' => $v); }, $v); })
220+
->then(function ($v) { return array_map(function ($v) { return ['name' => $v]; }, $v); })
221221
->end()
222222
->useAttributeAsKey('name')
223223
->prototype('array')
@@ -255,7 +255,7 @@ private function addFirewallsSection(ArrayNodeDefinition $rootNode, array $facto
255255
->end()
256256
;
257257

258-
$abstractFactoryKeys = array();
258+
$abstractFactoryKeys = [];
259259
foreach ($factories as $factoriesAtPosition) {
260260
foreach ($factoriesAtPosition as $factory) {
261261
$name = str_replace('-', '_', $factory->getKey());
@@ -301,17 +301,17 @@ private function addProvidersSection(ArrayNodeDefinition $rootNode)
301301
->fixXmlConfig('provider')
302302
->children()
303303
->arrayNode('providers')
304-
->example(array(
305-
'my_memory_provider' => array(
306-
'memory' => array(
307-
'users' => array(
308-
'foo' => array('password' => 'foo', 'roles' => 'ROLE_USER'),
309-
'bar' => array('password' => 'bar', 'roles' => '[ROLE_USER, ROLE_ADMIN]'),
310-
),
311-
),
312-
),
313-
'my_entity_provider' => array('entity' => array('class' => 'SecurityBundle:User', 'property' => 'username')),
314-
))
304+
->example([
305+
'my_memory_provider' => [
306+
'memory' => [
307+
'users' => [
308+
'foo' => ['password' => 'foo', 'roles' => 'ROLE_USER'],
309+
'bar' => ['password' => 'bar', 'roles' => '[ROLE_USER, ROLE_ADMIN]'],
310+
],
311+
],
312+
],
313+
'my_entity_provider' => ['entity' => ['class' => 'SecurityBundle:User', 'property' => 'username']],
314+
])
315315
->requiresAtLeastOneElement()
316316
->useAttributeAsKey('name')
317317
->prototype('array')
@@ -360,19 +360,19 @@ private function addEncodersSection(ArrayNodeDefinition $rootNode)
360360
->fixXmlConfig('encoder')
361361
->children()
362362
->arrayNode('encoders')
363-
->example(array(
363+
->example([
364364
'App\Entity\User1' => 'bcrypt',
365-
'App\Entity\User2' => array(
365+
'App\Entity\User2' => [
366366
'algorithm' => 'bcrypt',
367367
'cost' => 13,
368-
),
369-
))
368+
],
369+
])
370370
->requiresAtLeastOneElement()
371371
->useAttributeAsKey('class')
372372
->prototype('array')
373373
->canBeUnset()
374374
->performNoDeepMerging()
375-
->beforeNormalization()->ifString()->then(function ($v) { return array('algorithm' => $v); })->end()
375+
->beforeNormalization()->ifString()->then(function ($v) { return ['algorithm' => $v]; })->end()
376376
->children()
377377
->scalarNode('algorithm')->cannotBeEmpty()->end()
378378
->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()

0 commit comments

Comments
 (0)