Skip to content

Commit 52ba84c

Browse files
committed
switched array() to []
1 parent 9a91f19 commit 52ba84c

File tree

58 files changed

+402
-402
lines changed

Some content is hidden

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

58 files changed

+402
-402
lines changed

Authentication/RememberMe/InMemoryTokenProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*/
2121
class InMemoryTokenProvider implements TokenProviderInterface
2222
{
23-
private $tokens = array();
23+
private $tokens = [];
2424

2525
/**
2626
* {@inheritdoc}

Authentication/Token/AbstractToken.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@
2626
abstract class AbstractToken implements TokenInterface
2727
{
2828
private $user;
29-
private $roles = array();
29+
private $roles = [];
3030
private $authenticated = false;
31-
private $attributes = array();
31+
private $attributes = [];
3232

3333
/**
3434
* @param (RoleInterface|string)[] $roles An array of roles
3535
*
3636
* @throws \InvalidArgumentException
3737
*/
38-
public function __construct(array $roles = array())
38+
public function __construct(array $roles = [])
3939
{
4040
foreach ($roles as $role) {
4141
if (\is_string($role)) {
@@ -138,12 +138,12 @@ public function eraseCredentials()
138138
public function serialize()
139139
{
140140
return serialize(
141-
array(
141+
[
142142
\is_object($this->user) ? clone $this->user : $this->user,
143143
$this->authenticated,
144144
array_map(function ($role) { return clone $role; }, $this->roles),
145145
$this->attributes,
146-
)
146+
]
147147
);
148148
}
149149

@@ -224,7 +224,7 @@ public function __toString()
224224
$class = \get_class($this);
225225
$class = substr($class, strrpos($class, '\\') + 1);
226226

227-
$roles = array();
227+
$roles = [];
228228
foreach ($this->roles as $role) {
229229
$roles[] = $role->getRole();
230230
}

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($secret, $user, array $roles = array())
30+
public function __construct($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 (RoleInterface|string)[] $roles An array of roles
3131
*/
32-
public function __construct($user, $credentials, $providerKey, array $roles = array())
32+
public function __construct($user, $credentials, $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/RememberMeToken.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,11 @@ public function getCredentials()
9494
*/
9595
public function serialize()
9696
{
97-
return serialize(array(
97+
return serialize([
9898
$this->secret,
9999
$this->providerKey,
100100
parent::serialize(),
101-
));
101+
]);
102102
}
103103

104104
/**

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, $providerKey, array $roles = array())
34+
public function __construct($user, $credentials, $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
@@ -40,10 +40,10 @@ class AccessDecisionManager implements AccessDecisionManagerInterface
4040
*
4141
* @throws \InvalidArgumentException
4242
*/
43-
public function __construct($voters = array(), $strategy = self::STRATEGY_AFFIRMATIVE, $allowIfAllAbstainDecisions = false, $allowIfEqualGrantedDeniedDecisions = true)
43+
public function __construct($voters = [], $strategy = self::STRATEGY_AFFIRMATIVE, $allowIfAllAbstainDecisions = false, $allowIfEqualGrantedDeniedDecisions = true)
4444
{
4545
$strategyMethod = 'decide'.ucfirst($strategy);
46-
if (!\is_callable(array($this, $strategyMethod))) {
46+
if (!\is_callable([$this, $strategyMethod])) {
4747
throw new \InvalidArgumentException(sprintf('The strategy "%s" is not supported.', $strategy));
4848
}
4949

@@ -167,7 +167,7 @@ private function decideUnanimous(TokenInterface $token, array $attributes, $obje
167167
$grant = 0;
168168
foreach ($this->voters as $voter) {
169169
foreach ($attributes as $attribute) {
170-
$result = $this->vote($voter, $token, $object, array($attribute));
170+
$result = $this->vote($voter, $token, $object, [$attribute]);
171171

172172
switch ($result) {
173173
case VoterInterface::ACCESS_GRANTED:

Authorization/AuthorizationChecker.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ final public function isGranted($attributes, $subject = null)
6060
}
6161

6262
if (!\is_array($attributes)) {
63-
$attributes = array($attributes);
63+
$attributes = [$attributes];
6464
}
6565

6666
return $this->accessDecisionManager->decide($token, $attributes, $subject);

Authorization/ExpressionLanguage.php

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

Authorization/ExpressionLanguageProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class ExpressionLanguageProvider implements ExpressionFunctionProviderInterface
2323
{
2424
public function getFunctions()
2525
{
26-
return array(
26+
return [
2727
new ExpressionFunction('is_anonymous', function () {
2828
return '$trust_resolver->isAnonymous($token)';
2929
}, function (array $variables) {
@@ -53,6 +53,6 @@ public function getFunctions()
5353
}, function (array $variables, $role) {
5454
return \in_array($role, $variables['roles']);
5555
}),
56-
);
56+
];
5757
}
5858
}

0 commit comments

Comments
 (0)