Skip to content

Commit 48093b3

Browse files
committed
Enable the fixer enforcing fully-qualified calls for compiler-optimized functions
1 parent 3b1b30f commit 48093b3

20 files changed

+31
-31
lines changed

Authentication/AuthenticationProviderManager.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function __construct(array $providers, $eraseCredentials = true)
4848

4949
foreach ($providers as $provider) {
5050
if (!$provider instanceof AuthenticationProviderInterface) {
51-
throw new \InvalidArgumentException(sprintf('Provider "%s" must implement the AuthenticationProviderInterface.', get_class($provider)));
51+
throw new \InvalidArgumentException(sprintf('Provider "%s" must implement the AuthenticationProviderInterface.', \get_class($provider)));
5252
}
5353
}
5454

@@ -102,7 +102,7 @@ public function authenticate(TokenInterface $token)
102102
}
103103

104104
if (null === $lastException) {
105-
$lastException = new ProviderNotFoundException(sprintf('No Authentication Provider found for token of class "%s".', get_class($token)));
105+
$lastException = new ProviderNotFoundException(sprintf('No Authentication Provider found for token of class "%s".', \get_class($token)));
106106
}
107107

108108
if (null !== $this->eventDispatcher) {

Authentication/Token/AbstractToken.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ abstract class AbstractToken implements TokenInterface
3838
public function __construct(array $roles = array())
3939
{
4040
foreach ($roles as $role) {
41-
if (is_string($role)) {
41+
if (\is_string($role)) {
4242
$role = new Role($role);
4343
} elseif (!$role instanceof RoleInterface) {
44-
throw new \InvalidArgumentException(sprintf('$roles must be an array of strings, or RoleInterface instances, but got %s.', gettype($role)));
44+
throw new \InvalidArgumentException(sprintf('$roles must be an array of strings, or RoleInterface instances, but got %s.', \gettype($role)));
4545
}
4646

4747
$this->roles[] = $role;
@@ -81,7 +81,7 @@ public function getUser()
8181
*/
8282
public function setUser($user)
8383
{
84-
if (!($user instanceof UserInterface || (is_object($user) && method_exists($user, '__toString')) || is_string($user))) {
84+
if (!($user instanceof UserInterface || (\is_object($user) && method_exists($user, '__toString')) || \is_string($user))) {
8585
throw new \InvalidArgumentException('$user must be an instanceof UserInterface, an object implementing a __toString method, or a primitive string.');
8686
}
8787

@@ -139,7 +139,7 @@ public function serialize()
139139
{
140140
return serialize(
141141
array(
142-
is_object($this->user) ? clone $this->user : $this->user,
142+
\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,
@@ -221,7 +221,7 @@ public function setAttribute($name, $value)
221221
*/
222222
public function __toString()
223223
{
224-
$class = get_class($this);
224+
$class = \get_class($this);
225225
$class = substr($class, strrpos($class, '\\') + 1);
226226

227227
$roles = array();

Authentication/Token/UsernamePasswordToken.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function __construct($user, $credentials, $providerKey, array $roles = ar
4343
$this->credentials = $credentials;
4444
$this->providerKey = $providerKey;
4545

46-
parent::setAuthenticated(count($roles) > 0);
46+
parent::setAuthenticated(\count($roles) > 0);
4747
}
4848

4949
/**

Authorization/AccessDecisionManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class AccessDecisionManager implements AccessDecisionManagerInterface
4242
public function __construct(array $voters = array(), $strategy = self::STRATEGY_AFFIRMATIVE, $allowIfAllAbstainDecisions = false, $allowIfEqualGrantedDeniedDecisions = true)
4343
{
4444
$strategyMethod = 'decide'.ucfirst($strategy);
45-
if (!is_callable(array($this, $strategyMethod))) {
45+
if (!\is_callable(array($this, $strategyMethod))) {
4646
throw new \InvalidArgumentException(sprintf('The strategy "%s" is not supported.', $strategy));
4747
}
4848

Authorization/AuthorizationChecker.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ final public function isGranted($attributes, $object = null)
5959
$this->tokenStorage->setToken($token = $this->authenticationManager->authenticate($token));
6060
}
6161

62-
if (!is_array($attributes)) {
62+
if (!\is_array($attributes)) {
6363
$attributes = array($attributes);
6464
}
6565

Authorization/ExpressionLanguageProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function getFunctions()
5151
new ExpressionFunction('has_role', function ($role) {
5252
return sprintf('in_array(%s, $roles)', $role);
5353
}, function (array $variables, $role) {
54-
return in_array($role, $variables['roles']);
54+
return \in_array($role, $variables['roles']);
5555
}),
5656
);
5757
}

Authorization/Voter/AbstractVoter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ abstract class AbstractVoter implements VoterInterface
3030
*/
3131
public function supportsAttribute($attribute)
3232
{
33-
return in_array($attribute, $this->getSupportedAttributes(), true);
33+
return \in_array($attribute, $this->getSupportedAttributes(), true);
3434
}
3535

3636
/**
@@ -62,7 +62,7 @@ public function supportsClass($class)
6262
*/
6363
public function vote(TokenInterface $token, $object, array $attributes)
6464
{
65-
if (!$object || !$this->supportsClass(get_class($object))) {
65+
if (!$object || !$this->supportsClass(\get_class($object))) {
6666
return self::ACCESS_ABSTAIN;
6767
}
6868

Authorization/Voter/RoleVoter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function __construct($prefix = 'ROLE_')
3636
*/
3737
public function supportsAttribute($attribute)
3838
{
39-
return is_string($attribute) && 0 === strpos($attribute, $this->prefix);
39+
return \is_string($attribute) && 0 === strpos($attribute, $this->prefix);
4040
}
4141

4242
/**

Encoder/BasePasswordEncoder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ protected function demergePasswordAndSalt($mergedPasswordSalt)
3737
$salt = '';
3838
$saltBegins = strrpos($mergedPasswordSalt, '{');
3939

40-
if (false !== $saltBegins && $saltBegins + 1 < strlen($mergedPasswordSalt)) {
40+
if (false !== $saltBegins && $saltBegins + 1 < \strlen($mergedPasswordSalt)) {
4141
$salt = substr($mergedPasswordSalt, $saltBegins + 1, -1);
4242
$password = substr($mergedPasswordSalt, 0, $saltBegins);
4343
}
@@ -93,6 +93,6 @@ protected function comparePasswords($password1, $password2)
9393
*/
9494
protected function isPasswordTooLong($password)
9595
{
96-
return strlen($password) > static::MAX_PASSWORD_LENGTH;
96+
return \strlen($password) > static::MAX_PASSWORD_LENGTH;
9797
}
9898
}

Encoder/EncoderFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ public function getEncoder($user)
4040
$encoderKey = $encoderName;
4141
} else {
4242
foreach ($this->encoders as $class => $encoder) {
43-
if ((is_object($user) && $user instanceof $class) || (!is_object($user) && (is_subclass_of($user, $class) || $user == $class))) {
43+
if ((\is_object($user) && $user instanceof $class) || (!\is_object($user) && (is_subclass_of($user, $class) || $user == $class))) {
4444
$encoderKey = $class;
4545
break;
4646
}
4747
}
4848
}
4949

5050
if (null === $encoderKey) {
51-
throw new \RuntimeException(sprintf('No encoder has been configured for account "%s".', is_object($user) ? get_class($user) : $user));
51+
throw new \RuntimeException(sprintf('No encoder has been configured for account "%s".', \is_object($user) ? \get_class($user) : $user));
5252
}
5353

5454
if (!$this->encoders[$encoderKey] instanceof PasswordEncoderInterface) {

0 commit comments

Comments
 (0)