Skip to content

Commit f8a0bfe

Browse files
committed
fixed CS
1 parent 0ea88e5 commit f8a0bfe

14 files changed

+141
-141
lines changed

Authentication/Token/AnonymousToken.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class AnonymousToken extends AbstractToken
2727
* @param string|object $user The user can be a UserInterface instance, or an object implementing a __toString method or the username as a regular string
2828
* @param Role[] $roles An array of roles
2929
*/
30-
public function __construct(string $secret, $user, array $roles = array())
30+
public function __construct(string $secret, $user, array $roles = [])
3131
{
3232
parent::__construct($roles);
3333

@@ -59,7 +59,7 @@ public function getSecret()
5959
*/
6060
public function serialize()
6161
{
62-
return serialize(array($this->secret, parent::serialize()));
62+
return serialize([$this->secret, parent::serialize()]);
6363
}
6464

6565
/**

Authentication/Token/PreAuthenticatedToken.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class PreAuthenticatedToken extends AbstractToken
2929
* @param string $providerKey The provider key
3030
* @param (Role|string)[] $roles An array of roles
3131
*/
32-
public function __construct($user, $credentials, string $providerKey, array $roles = array())
32+
public function __construct($user, $credentials, string $providerKey, array $roles = [])
3333
{
3434
parent::__construct($roles);
3535

@@ -79,7 +79,7 @@ public function eraseCredentials()
7979
*/
8080
public function serialize()
8181
{
82-
return serialize(array($this->credentials, $this->providerKey, parent::serialize()));
82+
return serialize([$this->credentials, $this->providerKey, parent::serialize()]);
8383
}
8484

8585
/**

Authentication/Token/UsernamePasswordToken.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class UsernamePasswordToken extends AbstractToken
3131
*
3232
* @throws \InvalidArgumentException
3333
*/
34-
public function __construct($user, $credentials, string $providerKey, array $roles = array())
34+
public function __construct($user, $credentials, string $providerKey, array $roles = [])
3535
{
3636
parent::__construct($roles);
3737

@@ -91,7 +91,7 @@ public function eraseCredentials()
9191
*/
9292
public function serialize()
9393
{
94-
return serialize(array($this->credentials, $this->providerKey, parent::serialize()));
94+
return serialize([$this->credentials, $this->providerKey, parent::serialize()]);
9595
}
9696

9797
/**

Authorization/AccessDecisionManager.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ class AccessDecisionManager implements AccessDecisionManagerInterface
3939
*
4040
* @throws \InvalidArgumentException
4141
*/
42-
public function __construct(iterable $voters = array(), string $strategy = self::STRATEGY_AFFIRMATIVE, bool $allowIfAllAbstainDecisions = false, bool $allowIfEqualGrantedDeniedDecisions = true)
42+
public function __construct(iterable $voters = [], string $strategy = self::STRATEGY_AFFIRMATIVE, bool $allowIfAllAbstainDecisions = false, bool $allowIfEqualGrantedDeniedDecisions = true)
4343
{
4444
$strategyMethod = 'decide'.ucfirst($strategy);
45-
if (!\is_callable(array($this, $strategyMethod))) {
45+
if (!\is_callable([$this, $strategyMethod])) {
4646
throw new \InvalidArgumentException(sprintf('The strategy "%s" is not supported.', $strategy));
4747
}
4848

@@ -152,7 +152,7 @@ private function decideUnanimous(TokenInterface $token, array $attributes, $obje
152152
$grant = 0;
153153
foreach ($this->voters as $voter) {
154154
foreach ($attributes as $attribute) {
155-
$result = $voter->vote($token, $object, array($attribute));
155+
$result = $voter->vote($token, $object, [$attribute]);
156156

157157
switch ($result) {
158158
case VoterInterface::ACCESS_GRANTED:

Authorization/ExpressionLanguage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class ExpressionLanguage extends BaseExpressionLanguage
2929
/**
3030
* {@inheritdoc}
3131
*/
32-
public function __construct(CacheItemPoolInterface $cache = null, array $providers = array())
32+
public function __construct(CacheItemPoolInterface $cache = null, array $providers = [])
3333
{
3434
// prepend the default provider to let users override it easily
3535
array_unshift($providers, new ExpressionLanguageProvider());

Encoder/Argon2iPasswordEncoder.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*/
2222
class Argon2iPasswordEncoder extends BasePasswordEncoder implements SelfSaltingEncoderInterface
2323
{
24-
private $config = array();
24+
private $config = [];
2525

2626
/**
2727
* Argon2iPasswordEncoder constructor.
@@ -33,11 +33,11 @@ class Argon2iPasswordEncoder extends BasePasswordEncoder implements SelfSaltingE
3333
public function __construct(int $memoryCost = null, int $timeCost = null, int $threads = null)
3434
{
3535
if (\defined('PASSWORD_ARGON2I')) {
36-
$this->config = array(
36+
$this->config = [
3737
'memory_cost' => $memoryCost ?? \PASSWORD_ARGON2_DEFAULT_MEMORY_COST,
3838
'time_cost' => $timeCost ?? \PASSWORD_ARGON2_DEFAULT_TIME_COST,
3939
'threads' => $threads ?? \PASSWORD_ARGON2_DEFAULT_THREADS,
40-
);
40+
];
4141
}
4242
}
4343

Encoder/EncoderFactory.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -86,46 +86,46 @@ private function getEncoderConfigFromAlgorithm($config)
8686
{
8787
switch ($config['algorithm']) {
8888
case 'plaintext':
89-
return array(
89+
return [
9090
'class' => PlaintextPasswordEncoder::class,
91-
'arguments' => array($config['ignore_case']),
92-
);
91+
'arguments' => [$config['ignore_case']],
92+
];
9393

9494
case 'pbkdf2':
95-
return array(
95+
return [
9696
'class' => Pbkdf2PasswordEncoder::class,
97-
'arguments' => array(
97+
'arguments' => [
9898
$config['hash_algorithm'],
9999
$config['encode_as_base64'],
100100
$config['iterations'],
101101
$config['key_length'],
102-
),
103-
);
102+
],
103+
];
104104

105105
case 'bcrypt':
106-
return array(
106+
return [
107107
'class' => BCryptPasswordEncoder::class,
108-
'arguments' => array($config['cost']),
109-
);
108+
'arguments' => [$config['cost']],
109+
];
110110

111111
case 'argon2i':
112-
return array(
112+
return [
113113
'class' => Argon2iPasswordEncoder::class,
114-
'arguments' => array(
114+
'arguments' => [
115115
$config['memory_cost'],
116116
$config['time_cost'],
117117
$config['threads'],
118-
),
119-
);
118+
],
119+
];
120120
}
121121

122-
return array(
122+
return [
123123
'class' => MessageDigestPasswordEncoder::class,
124-
'arguments' => array(
124+
'arguments' => [
125125
$config['algorithm'],
126126
$config['encode_as_base64'],
127127
$config['iterations'],
128-
),
129-
);
128+
],
129+
];
130130
}
131131
}

Exception/CustomUserMessageAuthenticationException.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ class CustomUserMessageAuthenticationException extends AuthenticationException
2424
{
2525
private $messageKey;
2626

27-
private $messageData = array();
27+
private $messageData = [];
2828

29-
public function __construct(string $message = '', array $messageData = array(), int $code = 0, \Exception $previous = null)
29+
public function __construct(string $message = '', array $messageData = [], int $code = 0, \Exception $previous = null)
3030
{
3131
parent::__construct($message, $code, $previous);
3232

@@ -39,7 +39,7 @@ public function __construct(string $message = '', array $messageData = array(),
3939
* @param string $messageKey The message or message key
4040
* @param array $messageData Data to be passed into the translator
4141
*/
42-
public function setSafeMessage($messageKey, array $messageData = array())
42+
public function setSafeMessage($messageKey, array $messageData = [])
4343
{
4444
$this->messageKey = $messageKey;
4545
$this->messageData = $messageData;
@@ -60,11 +60,11 @@ public function getMessageData()
6060
*/
6161
public function serialize()
6262
{
63-
return serialize(array(
63+
return serialize([
6464
parent::serialize(),
6565
$this->messageKey,
6666
$this->messageData,
67-
));
67+
]);
6868
}
6969

7070
/**

Tests/Authentication/Token/AbstractTokenTest.php

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class ConcreteToken extends AbstractToken
3636
{
3737
private $credentials = 'credentials_value';
3838

39-
public function __construct($user, array $roles = array())
39+
public function __construct($user, array $roles = [])
4040
{
4141
parent::__construct($roles);
4242

@@ -45,7 +45,7 @@ public function __construct($user, array $roles = array())
4545

4646
public function serialize()
4747
{
48-
return serialize(array($this->credentials, parent::serialize()));
48+
return serialize([$this->credentials, parent::serialize()]);
4949
}
5050

5151
public function unserialize($serialized)
@@ -63,7 +63,7 @@ class AbstractTokenTest extends TestCase
6363
{
6464
public function testGetUsername()
6565
{
66-
$token = $this->getToken(array('ROLE_FOO'));
66+
$token = $this->getToken(['ROLE_FOO']);
6767
$token->setUser('fabien');
6868
$this->assertEquals('fabien', $token->getUsername());
6969

@@ -78,7 +78,7 @@ public function testGetUsername()
7878

7979
public function testEraseCredentials()
8080
{
81-
$token = $this->getToken(array('ROLE_FOO'));
81+
$token = $this->getToken(['ROLE_FOO']);
8282

8383
$user = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock();
8484
$user->expects($this->once())->method('eraseCredentials');
@@ -89,8 +89,8 @@ public function testEraseCredentials()
8989

9090
public function testSerialize()
9191
{
92-
$token = $this->getToken(array('ROLE_FOO', new Role('ROLE_BAR')));
93-
$token->setAttributes(array('foo' => 'bar'));
92+
$token = $this->getToken(['ROLE_FOO', new Role('ROLE_BAR')]);
93+
$token->setAttributes(['foo' => 'bar']);
9494

9595
$uToken = unserialize(serialize($token));
9696

@@ -100,7 +100,7 @@ public function testSerialize()
100100

101101
public function testSerializeWithRoleObjects()
102102
{
103-
$user = new User('name', 'password', array(new Role('ROLE_FOO'), new Role('ROLE_BAR')));
103+
$user = new User('name', 'password', [new Role('ROLE_FOO'), new Role('ROLE_BAR')]);
104104
$token = new ConcreteToken($user, $user->getRoles());
105105

106106
$serialized = serialize($token);
@@ -114,9 +114,9 @@ public function testSerializeWithRoleObjects()
114114
public function testSerializeParent()
115115
{
116116
$user = new TestUser('fabien');
117-
$token = new ConcreteToken($user, array('ROLE_FOO'));
117+
$token = new ConcreteToken($user, ['ROLE_FOO']);
118118

119-
$parentToken = new ConcreteToken($user, array(new SwitchUserRole('ROLE_PREVIOUS', $token)));
119+
$parentToken = new ConcreteToken($user, [new SwitchUserRole('ROLE_PREVIOUS', $token)]);
120120
$uToken = unserialize(serialize($parentToken));
121121

122122
$this->assertEquals(
@@ -127,14 +127,14 @@ public function testSerializeParent()
127127

128128
public function testConstructor()
129129
{
130-
$token = $this->getToken(array('ROLE_FOO'));
131-
$this->assertEquals(array(new Role('ROLE_FOO')), $token->getRoles());
130+
$token = $this->getToken(['ROLE_FOO']);
131+
$this->assertEquals([new Role('ROLE_FOO')], $token->getRoles());
132132

133-
$token = $this->getToken(array(new Role('ROLE_FOO')));
134-
$this->assertEquals(array(new Role('ROLE_FOO')), $token->getRoles());
133+
$token = $this->getToken([new Role('ROLE_FOO')]);
134+
$this->assertEquals([new Role('ROLE_FOO')], $token->getRoles());
135135

136-
$token = $this->getToken(array(new Role('ROLE_FOO'), 'ROLE_BAR'));
137-
$this->assertEquals(array(new Role('ROLE_FOO'), new Role('ROLE_BAR')), $token->getRoles());
136+
$token = $this->getToken([new Role('ROLE_FOO'), 'ROLE_BAR']);
137+
$this->assertEquals([new Role('ROLE_FOO'), new Role('ROLE_BAR')], $token->getRoles());
138138
}
139139

140140
public function testAuthenticatedFlag()
@@ -151,7 +151,7 @@ public function testAuthenticatedFlag()
151151

152152
public function testAttributes()
153153
{
154-
$attributes = array('foo' => 'bar');
154+
$attributes = ['foo' => 'bar'];
155155
$token = $this->getToken();
156156
$token->setAttributes($attributes);
157157

@@ -185,11 +185,11 @@ public function getUsers()
185185
{
186186
$user = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock();
187187

188-
return array(
189-
array($user),
190-
array(new TestUser('foo')),
191-
array('foo'),
192-
);
188+
return [
189+
[$user],
190+
[new TestUser('foo')],
191+
['foo'],
192+
];
193193
}
194194

195195
/**
@@ -212,16 +212,16 @@ public function getUserChanges()
212212
{
213213
$user = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock();
214214

215-
return array(
216-
array('foo', 'bar'),
217-
array('foo', new TestUser('bar')),
218-
array('foo', $user),
219-
array($user, 'foo'),
220-
array($user, new TestUser('foo')),
221-
array(new TestUser('foo'), new TestUser('bar')),
222-
array(new TestUser('foo'), 'bar'),
223-
array(new TestUser('foo'), $user),
224-
);
215+
return [
216+
['foo', 'bar'],
217+
['foo', new TestUser('bar')],
218+
['foo', $user],
219+
[$user, 'foo'],
220+
[$user, new TestUser('foo')],
221+
[new TestUser('foo'), new TestUser('bar')],
222+
[new TestUser('foo'), 'bar'],
223+
[new TestUser('foo'), $user],
224+
];
225225
}
226226

227227
/**
@@ -247,22 +247,22 @@ public function getUserChangesAdvancedUser()
247247
$user = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock();
248248
$advancedUser = $this->getMockBuilder('Symfony\Component\Security\Core\User\AdvancedUserInterface')->getMock();
249249

250-
return array(
251-
array('foo', 'bar'),
252-
array('foo', new TestUser('bar')),
253-
array('foo', $user),
254-
array('foo', $advancedUser),
255-
array($user, 'foo'),
256-
array($advancedUser, 'foo'),
257-
array($user, new TestUser('foo')),
258-
array($advancedUser, new TestUser('foo')),
259-
array(new TestUser('foo'), new TestUser('bar')),
260-
array(new TestUser('foo'), 'bar'),
261-
array(new TestUser('foo'), $user),
262-
array(new TestUser('foo'), $advancedUser),
263-
array($user, $advancedUser),
264-
array($advancedUser, $user),
265-
);
250+
return [
251+
['foo', 'bar'],
252+
['foo', new TestUser('bar')],
253+
['foo', $user],
254+
['foo', $advancedUser],
255+
[$user, 'foo'],
256+
[$advancedUser, 'foo'],
257+
[$user, new TestUser('foo')],
258+
[$advancedUser, new TestUser('foo')],
259+
[new TestUser('foo'), new TestUser('bar')],
260+
[new TestUser('foo'), 'bar'],
261+
[new TestUser('foo'), $user],
262+
[new TestUser('foo'), $advancedUser],
263+
[$user, $advancedUser],
264+
[$advancedUser, $user],
265+
];
266266
}
267267

268268
/**
@@ -281,8 +281,8 @@ public function testSetUserDoesNotSetAuthenticatedToFalseWhenUserDoesNotChange($
281281
$this->assertTrue($token->isAuthenticated());
282282
}
283283

284-
protected function getToken(array $roles = array())
284+
protected function getToken(array $roles = [])
285285
{
286-
return $this->getMockForAbstractClass('Symfony\Component\Security\Core\Authentication\Token\AbstractToken', array($roles));
286+
return $this->getMockForAbstractClass('Symfony\Component\Security\Core\Authentication\Token\AbstractToken', [$roles]);
287287
}
288288
}

0 commit comments

Comments
 (0)