Skip to content

Commit 4eafafd

Browse files
committed
Merge branch '4.2' into short-array-master
* 4.2: fixed CS fixed CS 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 debbe94 + be5e6b7 commit 4eafafd

File tree

62 files changed

+543
-543
lines changed

Some content is hidden

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

62 files changed

+543
-543
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
@@ -25,16 +25,16 @@
2525
abstract class AbstractToken implements TokenInterface
2626
{
2727
private $user;
28-
private $roles = array();
28+
private $roles = [];
2929
private $authenticated = false;
30-
private $attributes = array();
30+
private $attributes = [];
3131

3232
/**
3333
* @param (Role|string)[] $roles An array of roles
3434
*
3535
* @throws \InvalidArgumentException
3636
*/
37-
public function __construct(array $roles = array())
37+
public function __construct(array $roles = [])
3838
{
3939
foreach ($roles as $role) {
4040
if (\is_string($role)) {
@@ -137,12 +137,12 @@ public function eraseCredentials()
137137
public function serialize()
138138
{
139139
return serialize(
140-
array(
140+
[
141141
\is_object($this->user) ? clone $this->user : $this->user,
142142
$this->authenticated,
143143
array_map(function ($role) { return clone $role; }, $this->roles),
144144
$this->attributes,
145-
)
145+
]
146146
);
147147
}
148148

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

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

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/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, 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/AuthorizationChecker.php

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

5656
if (!\is_array($attributes)) {
57-
$attributes = array($attributes);
57+
$attributes = [$attributes];
5858
}
5959

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

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());

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) {
@@ -63,6 +63,6 @@ public function getFunctions()
6363

6464
return \in_array($role, $variables['roles']);
6565
}),
66-
);
66+
];
6767
}
6868
}

0 commit comments

Comments
 (0)