Skip to content

Commit 637ba4c

Browse files
Merge branch '3.4' into 4.4
* 3.4: Enable "native_constant_invocation" CS rule Make AbstractPhpFileCacheWarmer public
2 parents 3a78edf + 8347ac1 commit 637ba4c

25 files changed

+60
-60
lines changed

Authentication/AuthenticationTrustResolver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ public function __construct(string $anonymousClass = null, string $rememberMeCla
3131
$this->rememberMeClass = $rememberMeClass;
3232

3333
if (null !== $anonymousClass && !is_a($anonymousClass, AnonymousToken::class, true)) {
34-
@trigger_error(sprintf('Configuring a custom anonymous token class is deprecated since Symfony 4.2; have the "%s" class extend the "%s" class instead, and remove the "%s" constructor argument.', $anonymousClass, AnonymousToken::class, self::class), E_USER_DEPRECATED);
34+
@trigger_error(sprintf('Configuring a custom anonymous token class is deprecated since Symfony 4.2; have the "%s" class extend the "%s" class instead, and remove the "%s" constructor argument.', $anonymousClass, AnonymousToken::class, self::class), \E_USER_DEPRECATED);
3535
}
3636

3737
if (null !== $rememberMeClass && !is_a($rememberMeClass, RememberMeToken::class, true)) {
38-
@trigger_error(sprintf('Configuring a custom remember me token class is deprecated since Symfony 4.2; have the "%s" class extend the "%s" class instead, and remove the "%s" constructor argument.', $rememberMeClass, RememberMeToken::class, self::class), E_USER_DEPRECATED);
38+
@trigger_error(sprintf('Configuring a custom remember me token class is deprecated since Symfony 4.2; have the "%s" class extend the "%s" class instead, and remove the "%s" constructor argument.', $rememberMeClass, RememberMeToken::class, self::class), \E_USER_DEPRECATED);
3939
}
4040
}
4141

Authentication/Provider/LdapBindAuthenticationProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ protected function checkAuthentication(UserInterface $user, UsernamePasswordToke
8787
if ('' !== $this->searchDn && '' !== $this->searchPassword) {
8888
$this->ldap->bind($this->searchDn, $this->searchPassword);
8989
} else {
90-
@trigger_error('Using the "query_string" config without using a "search_dn" and a "search_password" is deprecated since Symfony 4.4 and will throw an exception in Symfony 5.0.', E_USER_DEPRECATED);
90+
@trigger_error('Using the "query_string" config without using a "search_dn" and a "search_password" is deprecated since Symfony 4.4 and will throw an exception in Symfony 5.0.', \E_USER_DEPRECATED);
9191
}
9292
$username = $this->ldap->escape($username, '', LdapInterface::ESCAPE_FILTER);
9393
$query = str_replace('{username}', $username, $this->queryString);

Authentication/Provider/SimpleAuthenticationProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
use Symfony\Component\Security\Core\User\UserInterface;
2020
use Symfony\Component\Security\Core\User\UserProviderInterface;
2121

22-
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.2, use Guard instead.', SimpleAuthenticationProvider::class), E_USER_DEPRECATED);
22+
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.2, use Guard instead.', SimpleAuthenticationProvider::class), \E_USER_DEPRECATED);
2323

2424
/**
2525
* @author Jordi Boggiano <[email protected]>

Authentication/Token/AbstractToken.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function getRoleNames(): array
6060
public function getRoles()
6161
{
6262
if (0 === \func_num_args() || func_get_arg(0)) {
63-
@trigger_error(sprintf('The %s() method is deprecated since Symfony 4.3. Use the getRoleNames() method instead.', __METHOD__), E_USER_DEPRECATED);
63+
@trigger_error(sprintf('The %s() method is deprecated since Symfony 4.3. Use the getRoleNames() method instead.', __METHOD__), \E_USER_DEPRECATED);
6464
}
6565

6666
return $this->roles;
@@ -174,7 +174,7 @@ public function serialize()
174174
$serialized = $this->__serialize();
175175

176176
if (null === $isCalledFromOverridingMethod = \func_num_args() ? func_get_arg(0) : null) {
177-
$trace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 2);
177+
$trace = debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT, 2);
178178
$isCalledFromOverridingMethod = isset($trace[1]['function'], $trace[1]['object']) && 'serialize' === $trace[1]['function'] && $this === $trace[1]['object'];
179179
}
180180

@@ -332,7 +332,7 @@ private function hasUserChanged(UserInterface $user): bool
332332
}
333333

334334
if ($this->user instanceof AdvancedUserInterface && $user instanceof AdvancedUserInterface) {
335-
@trigger_error(sprintf('Checking for the AdvancedUserInterface in "%s()" is deprecated since Symfony 4.1 and support for it will be removed in 5.0. Implement the %s to check if the user has been changed,', __METHOD__, EquatableInterface::class), E_USER_DEPRECATED);
335+
@trigger_error(sprintf('Checking for the AdvancedUserInterface in "%s()" is deprecated since Symfony 4.1 and support for it will be removed in 5.0. Implement the %s to check if the user has been changed,', __METHOD__, EquatableInterface::class), \E_USER_DEPRECATED);
336336
if ($this->user->isAccountNonExpired() !== $user->isAccountNonExpired()) {
337337
return true;
338338
}
@@ -349,7 +349,7 @@ private function hasUserChanged(UserInterface $user): bool
349349
return true;
350350
}
351351
} elseif ($this->user instanceof AdvancedUserInterface xor $user instanceof AdvancedUserInterface) {
352-
@trigger_error(sprintf('Checking for the AdvancedUserInterface in "%s()" is deprecated since Symfony 4.1 and support for it will be removed in 5.0. Implement the %s to check if the user has been changed,', __METHOD__, EquatableInterface::class), E_USER_DEPRECATED);
352+
@trigger_error(sprintf('Checking for the AdvancedUserInterface in "%s()" is deprecated since Symfony 4.1 and support for it will be removed in 5.0. Implement the %s to check if the user has been changed,', __METHOD__, EquatableInterface::class), \E_USER_DEPRECATED);
353353

354354
return true;
355355
}

Authentication/Token/Storage/TokenStorage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function getToken()
4646
public function setToken(TokenInterface $token = null)
4747
{
4848
if (null !== $token && !method_exists($token, 'getRoleNames') && !$token instanceof \PHPUnit\Framework\MockObject\MockObject && !$token instanceof \Prophecy\Prophecy\ProphecySubjectInterface) {
49-
@trigger_error(sprintf('Not implementing the "%s::getRoleNames()" method in "%s" is deprecated since Symfony 4.3.', TokenInterface::class, \get_class($token)), E_USER_DEPRECATED);
49+
@trigger_error(sprintf('Not implementing the "%s::getRoleNames()" method in "%s" is deprecated since Symfony 4.3.', TokenInterface::class, \get_class($token)), \E_USER_DEPRECATED);
5050
}
5151

5252
if ($token) {

Authorization/AccessDecisionManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function decide(TokenInterface $token, array $attributes, $object = null/
6363

6464
// Special case for AccessListener, do not remove the right side of the condition before 6.0
6565
if (\count($attributes) > 1 && !$allowMultipleAttributes) {
66-
@trigger_error(sprintf('Passing more than one Security attribute to "%s()" is deprecated since Symfony 4.4. Use multiple "decide()" calls or the expression language (e.g. "is_granted(...) or is_granted(...)") instead.', __METHOD__), E_USER_DEPRECATED);
66+
@trigger_error(sprintf('Passing more than one Security attribute to "%s()" is deprecated since Symfony 4.4. Use multiple "decide()" calls or the expression language (e.g. "is_granted(...) or is_granted(...)") instead.', __METHOD__), \E_USER_DEPRECATED);
6767
}
6868

6969
return $this->{$this->strategy}($token, $attributes, $object);

Authorization/AuthorizationChecker.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ final public function isGranted($attributes, $subject = null): bool
5656
if (!\is_array($attributes)) {
5757
$attributes = [$attributes];
5858
} else {
59-
@trigger_error(sprintf('Passing an array of Security attributes to %s() is deprecated since Symfony 4.4. Use multiple isGranted() calls or the expression language (e.g. "is_granted(...) or is_granted(...)") instead.', __METHOD__), E_USER_DEPRECATED);
59+
@trigger_error(sprintf('Passing an array of Security attributes to %s() is deprecated since Symfony 4.4. Use multiple isGranted() calls or the expression language (e.g. "is_granted(...) or is_granted(...)") instead.', __METHOD__), \E_USER_DEPRECATED);
6060
}
6161

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

Authorization/ExpressionLanguageProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ public function getFunctions()
5555
}),
5656

5757
new ExpressionFunction('has_role', function ($role) {
58-
@trigger_error('Using the "has_role()" function in security expressions is deprecated since Symfony 4.2, use "is_granted()" instead.', E_USER_DEPRECATED);
58+
@trigger_error('Using the "has_role()" function in security expressions is deprecated since Symfony 4.2, use "is_granted()" instead.', \E_USER_DEPRECATED);
5959

6060
return sprintf('in_array(%s, $roles)', $role);
6161
}, function (array $variables, $role) {
62-
@trigger_error('Using the "has_role()" function in security expressions is deprecated since Symfony 4.2, use "is_granted()" instead.', E_USER_DEPRECATED);
62+
@trigger_error('Using the "has_role()" function in security expressions is deprecated since Symfony 4.2, use "is_granted()" instead.', \E_USER_DEPRECATED);
6363

6464
return \in_array($role, $variables['roles']);
6565
}),

Authorization/Voter/ExpressionVoter.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ class ExpressionVoter implements VoterInterface
3939
public function __construct(ExpressionLanguage $expressionLanguage, AuthenticationTrustResolverInterface $trustResolver, $authChecker = null, RoleHierarchyInterface $roleHierarchy = null)
4040
{
4141
if ($authChecker instanceof RoleHierarchyInterface) {
42-
@trigger_error(sprintf('Passing a RoleHierarchyInterface to "%s()" is deprecated since Symfony 4.2. Pass an AuthorizationCheckerInterface instead.', __METHOD__), E_USER_DEPRECATED);
42+
@trigger_error(sprintf('Passing a RoleHierarchyInterface to "%s()" is deprecated since Symfony 4.2. Pass an AuthorizationCheckerInterface instead.', __METHOD__), \E_USER_DEPRECATED);
4343
$roleHierarchy = $authChecker;
4444
$authChecker = null;
4545

4646
if (!method_exists($roleHierarchy, 'getReachableRoleNames')) {
47-
@trigger_error(sprintf('Not implementing the "%s::getReachableRoleNames()" method in "%s" is deprecated since Symfony 4.3.', RoleHierarchyInterface::class, \get_class($this->roleHierarchy)), E_USER_DEPRECATED);
47+
@trigger_error(sprintf('Not implementing the "%s::getReachableRoleNames()" method in "%s" is deprecated since Symfony 4.3.', RoleHierarchyInterface::class, \get_class($this->roleHierarchy)), \E_USER_DEPRECATED);
4848
}
4949
} elseif (null === $authChecker) {
50-
@trigger_error(sprintf('Argument 3 passed to "%s()" should be an instance of AuthorizationCheckerInterface, not passing it is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED);
50+
@trigger_error(sprintf('Argument 3 passed to "%s()" should be an instance of AuthorizationCheckerInterface, not passing it is deprecated since Symfony 4.2.', __METHOD__), \E_USER_DEPRECATED);
5151
} elseif (!$authChecker instanceof AuthorizationCheckerInterface) {
5252
throw new \TypeError(sprintf('Argument 3 passed to "%s()" must be an instance of "%s" or null, "%s" given.', __METHOD__, AuthorizationCheckerInterface::class, \is_object($authChecker) ? \get_class($authChecker) : \gettype($authChecker)));
5353
}
@@ -63,7 +63,7 @@ public function __construct(ExpressionLanguage $expressionLanguage, Authenticati
6363
*/
6464
public function addExpressionLanguageProvider(ExpressionFunctionProviderInterface $provider)
6565
{
66-
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, register the provider directly on the injected ExpressionLanguage instance instead.', __METHOD__), E_USER_DEPRECATED);
66+
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, register the provider directly on the injected ExpressionLanguage instance instead.', __METHOD__), \E_USER_DEPRECATED);
6767

6868
$this->expressionLanguage->registerProvider($provider);
6969
}
@@ -99,7 +99,7 @@ private function getVariables(TokenInterface $token, $subject): array
9999
$roleNames = $token->getRoleNames();
100100
$roles = array_map(function (string $role) { return new Role($role, false); }, $roleNames);
101101
} else {
102-
@trigger_error(sprintf('Not implementing the "%s::getRoleNames()" method in "%s" is deprecated since Symfony 4.3.', TokenInterface::class, \get_class($token)), E_USER_DEPRECATED);
102+
@trigger_error(sprintf('Not implementing the "%s::getRoleNames()" method in "%s" is deprecated since Symfony 4.3.', TokenInterface::class, \get_class($token)), \E_USER_DEPRECATED);
103103

104104
$roles = $token->getRoles(false);
105105
$roleNames = array_map(function (Role $role) { return $role->getRole(); }, $roles);

Authorization/Voter/RoleHierarchyVoter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class RoleHierarchyVoter extends RoleVoter
2929
public function __construct(RoleHierarchyInterface $roleHierarchy, string $prefix = 'ROLE_')
3030
{
3131
if (!method_exists($roleHierarchy, 'getReachableRoleNames')) {
32-
@trigger_error(sprintf('Not implementing the "%s::getReachableRoleNames()" method in "%s" is deprecated since Symfony 4.3.', RoleHierarchyInterface::class, \get_class($roleHierarchy)), E_USER_DEPRECATED);
32+
@trigger_error(sprintf('Not implementing the "%s::getReachableRoleNames()" method in "%s" is deprecated since Symfony 4.3.', RoleHierarchyInterface::class, \get_class($roleHierarchy)), \E_USER_DEPRECATED);
3333
}
3434

3535
$this->roleHierarchy = $roleHierarchy;
@@ -46,7 +46,7 @@ protected function extractRoles(TokenInterface $token)
4646
if (method_exists($token, 'getRoleNames')) {
4747
$roles = $token->getRoleNames();
4848
} else {
49-
@trigger_error(sprintf('Not implementing the "%s::getRoleNames()" method in "%s" is deprecated since Symfony 4.3.', TokenInterface::class, \get_class($token)), E_USER_DEPRECATED);
49+
@trigger_error(sprintf('Not implementing the "%s::getRoleNames()" method in "%s" is deprecated since Symfony 4.3.', TokenInterface::class, \get_class($token)), \E_USER_DEPRECATED);
5050

5151
$roles = array_map(function (Role $role) { return $role->getRole(); }, $token->getRoles(false));
5252
}

Authorization/Voter/RoleVoter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ protected function extractRoles(TokenInterface $token)
6262
return $token->getRoleNames();
6363
}
6464

65-
@trigger_error(sprintf('Not implementing the "%s::getRoleNames()" method in "%s" is deprecated since Symfony 4.3.', TokenInterface::class, \get_class($token)), E_USER_DEPRECATED);
65+
@trigger_error(sprintf('Not implementing the "%s::getRoleNames()" method in "%s" is deprecated since Symfony 4.3.', TokenInterface::class, \get_class($token)), \E_USER_DEPRECATED);
6666

6767
return array_map(function (Role $role) { return $role->getRole(); }, $token->getRoles(false));
6868
}

Encoder/Argon2iPasswordEncoder.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace Symfony\Component\Security\Core\Encoder;
1313

14-
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" instead.', Argon2iPasswordEncoder::class, SodiumPasswordEncoder::class), E_USER_DEPRECATED);
14+
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" instead.', Argon2iPasswordEncoder::class, SodiumPasswordEncoder::class), \E_USER_DEPRECATED);
1515

1616
use Symfony\Component\Security\Core\Exception\BadCredentialsException;
1717

@@ -38,9 +38,9 @@ public function __construct(int $memoryCost = null, int $timeCost = null, int $t
3838
{
3939
if (\defined('PASSWORD_ARGON2I')) {
4040
$this->config = [
41-
'memory_cost' => $memoryCost ?? PASSWORD_ARGON2_DEFAULT_MEMORY_COST,
42-
'time_cost' => $timeCost ?? PASSWORD_ARGON2_DEFAULT_TIME_COST,
43-
'threads' => $threads ?? PASSWORD_ARGON2_DEFAULT_THREADS,
41+
'memory_cost' => $memoryCost ?? \PASSWORD_ARGON2_DEFAULT_MEMORY_COST,
42+
'time_cost' => $timeCost ?? \PASSWORD_ARGON2_DEFAULT_TIME_COST,
43+
'threads' => $threads ?? \PASSWORD_ARGON2_DEFAULT_THREADS,
4444
];
4545
}
4646
}
@@ -51,7 +51,7 @@ public static function isSupported()
5151
return true;
5252
}
5353

54-
return version_compare(\extension_loaded('sodium') ? SODIUM_LIBRARY_VERSION : phpversion('libsodium'), '1.0.9', '>=');
54+
return version_compare(\extension_loaded('sodium') ? \SODIUM_LIBRARY_VERSION : phpversion('libsodium'), '1.0.9', '>=');
5555
}
5656

5757
/**
@@ -104,15 +104,15 @@ public function isPasswordValid($encoded, $raw, $salt)
104104

105105
private function encodePasswordNative(string $raw): string
106106
{
107-
return password_hash($raw, PASSWORD_ARGON2I, $this->config);
107+
return password_hash($raw, \PASSWORD_ARGON2I, $this->config);
108108
}
109109

110110
private function encodePasswordSodiumFunction(string $raw): string
111111
{
112112
$hash = sodium_crypto_pwhash_str(
113113
$raw,
114-
SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE,
115-
SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE
114+
\SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE,
115+
\SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE
116116
);
117117
sodium_memzero($raw);
118118

Encoder/BCryptPasswordEncoder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace Symfony\Component\Security\Core\Encoder;
1313

14-
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" instead.', BCryptPasswordEncoder::class, NativePasswordEncoder::class), E_USER_DEPRECATED);
14+
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" instead.', BCryptPasswordEncoder::class, NativePasswordEncoder::class), \E_USER_DEPRECATED);
1515

1616
use Symfony\Component\Security\Core\Exception\BadCredentialsException;
1717

@@ -74,7 +74,7 @@ public function encodePassword($raw, $salt)
7474
// Ignore $salt, the auto-generated one is always the best
7575
}
7676

77-
return password_hash($raw, PASSWORD_BCRYPT, $options);
77+
return password_hash($raw, \PASSWORD_BCRYPT, $options);
7878
}
7979

8080
/**

Encoder/EncoderFactory.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ private function getEncoderConfigFromAlgorithm(array $config): array
153153

154154
case 'bcrypt':
155155
$config['algorithm'] = 'native';
156-
$config['native_algorithm'] = PASSWORD_BCRYPT;
156+
$config['native_algorithm'] = \PASSWORD_BCRYPT;
157157

158158
return $this->getEncoderConfigFromAlgorithm($config);
159159

@@ -181,7 +181,7 @@ private function getEncoderConfigFromAlgorithm(array $config): array
181181
$config['algorithm'] = 'sodium';
182182
} elseif (\defined('PASSWORD_ARGON2I')) {
183183
$config['algorithm'] = 'native';
184-
$config['native_algorithm'] = PASSWORD_ARGON2I;
184+
$config['native_algorithm'] = \PASSWORD_ARGON2I;
185185
} else {
186186
throw new LogicException(sprintf('Algorithm "argon2i" is not available. Either use %s"auto" or upgrade to PHP 7.2+ instead.', \defined('SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13') ? '"argon2id", ' : ''));
187187
}
@@ -193,7 +193,7 @@ private function getEncoderConfigFromAlgorithm(array $config): array
193193
$config['algorithm'] = 'sodium';
194194
} elseif (\defined('PASSWORD_ARGON2ID')) {
195195
$config['algorithm'] = 'native';
196-
$config['native_algorithm'] = PASSWORD_ARGON2ID;
196+
$config['native_algorithm'] = \PASSWORD_ARGON2ID;
197197
} else {
198198
throw new LogicException(sprintf('Algorithm "argon2id" is not available. Either use %s"auto", upgrade to PHP 7.3+ or use libsodium 1.0.15+ instead.', \defined('PASSWORD_ARGON2I') || $hasSodium ? '"argon2i", ' : ''));
199199
}

0 commit comments

Comments
 (0)