Skip to content

Commit 274b0eb

Browse files
Merge branch '3.4' into 4.4
* 3.4: Enable "native_constant_invocation" CS rule Make AbstractPhpFileCacheWarmer public
2 parents ad02627 + 5e95789 commit 274b0eb

16 files changed

+30
-30
lines changed

Command/UserPasswordEncoderCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
134134
if ($input->isInteractive() && !$emptySalt) {
135135
$emptySalt = true;
136136

137-
$errorIo->note('The command will take care of generating a salt for you. Be aware that some encoders advise to let them generate their own salt. If you\'re using one of those encoders, please answer \'no\' to the question below. '.PHP_EOL.'Provide the \'empty-salt\' option in order to let the encoder handle the generation itself.');
137+
$errorIo->note('The command will take care of generating a salt for you. Be aware that some encoders advise to let them generate their own salt. If you\'re using one of those encoders, please answer \'no\' to the question below. '.\PHP_EOL.'Provide the \'empty-salt\' option in order to let the encoder handle the generation itself.');
138138

139139
if ($errorIo->confirm('Confirm salt generation ?')) {
140140
$salt = $this->generateSalt();

Debug/WrappedListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function __invoke(RequestEvent $event)
4343
if (\is_callable($this->listener)) {
4444
($this->listener)($event);
4545
} else {
46-
@trigger_error(sprintf('Calling the "%s::handle()" method from the firewall is deprecated since Symfony 4.3, extend "%s" instead.', \get_class($this->listener), AbstractListener::class), E_USER_DEPRECATED);
46+
@trigger_error(sprintf('Calling the "%s::handle()" method from the firewall is deprecated since Symfony 4.3, extend "%s" instead.', \get_class($this->listener), AbstractListener::class), \E_USER_DEPRECATED);
4747
$this->listener->handle($event);
4848
}
4949
$this->time = microtime(true) - $startTime;

DependencyInjection/MainConfiguration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ private function addFirewallsSection(ArrayNodeDefinition $rootNode, array $facto
228228
foreach ($v as $originalName => $cookieConfig) {
229229
if (false !== strpos($originalName, '-')) {
230230
$normalizedName = str_replace('-', '_', $originalName);
231-
@trigger_error(sprintf('Normalization of cookie names is deprecated since Symfony 4.3. Starting from Symfony 5.0, the "%s" cookie configured in "logout.delete_cookies" will delete the "%s" cookie instead of the "%s" cookie.', $originalName, $originalName, $normalizedName), E_USER_DEPRECATED);
231+
@trigger_error(sprintf('Normalization of cookie names is deprecated since Symfony 4.3. Starting from Symfony 5.0, the "%s" cookie configured in "logout.delete_cookies" will delete the "%s" cookie instead of the "%s" cookie.', $originalName, $originalName, $normalizedName), \E_USER_DEPRECATED);
232232

233233
// normalize cookie names manually for BC reasons. Remove it in Symfony 5.0.
234234
$v[$normalizedName] = $cookieConfig;

DependencyInjection/Security/Factory/FormLoginLdapFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ protected function createAuthProvider(ContainerBuilder $container, $id, $config,
4040

4141
if (!empty($config['query_string'])) {
4242
if ('' === $config['search_dn'] || '' === $config['search_password']) {
43-
@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);
43+
@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);
4444
}
4545
$definition->addMethodCall('setQueryString', [$config['query_string']]);
4646
}

DependencyInjection/Security/Factory/HttpBasicLdapFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function create(ContainerBuilder $container, $id, $config, $userProvider,
4444

4545
if (!empty($config['query_string'])) {
4646
if ('' === $config['search_dn'] || '' === $config['search_password']) {
47-
@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);
47+
@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);
4848
}
4949
$definition->addMethodCall('setQueryString', [$config['query_string']]);
5050
}

DependencyInjection/Security/Factory/JsonLoginLdapFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ protected function createAuthProvider(ContainerBuilder $container, $id, $config,
4242

4343
if (!empty($config['query_string'])) {
4444
if ('' === $config['search_dn'] || '' === $config['search_password']) {
45-
@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);
45+
@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);
4646
}
4747
$definition->addMethodCall('setQueryString', [$config['query_string']]);
4848
}

DependencyInjection/Security/Factory/SimpleFormFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function __construct(bool $triggerDeprecation = true)
3030
$this->addOption('authenticator', null);
3131

3232
if ($triggerDeprecation) {
33-
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.2, use Guard instead.', __CLASS__), E_USER_DEPRECATED);
33+
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.2, use Guard instead.', __CLASS__), \E_USER_DEPRECATED);
3434
}
3535
}
3636

DependencyInjection/Security/Factory/SimplePreAuthenticationFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class SimplePreAuthenticationFactory implements SecurityFactoryInterface
2626
public function __construct(bool $triggerDeprecation = true)
2727
{
2828
if ($triggerDeprecation) {
29-
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.2, use Guard instead.', __CLASS__), E_USER_DEPRECATED);
29+
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.2, use Guard instead.', __CLASS__), \E_USER_DEPRECATED);
3030
}
3131
}
3232

DependencyInjection/SecurityExtension.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ private function createEncoder(array $config)
545545
// bcrypt encoder
546546
if ('bcrypt' === $config['algorithm']) {
547547
$config['algorithm'] = 'native';
548-
$config['native_algorithm'] = PASSWORD_BCRYPT;
548+
$config['native_algorithm'] = \PASSWORD_BCRYPT;
549549

550550
return $this->createEncoder($config);
551551
}
@@ -556,7 +556,7 @@ private function createEncoder(array $config)
556556
$config['algorithm'] = 'sodium';
557557
} elseif (\defined('PASSWORD_ARGON2I')) {
558558
$config['algorithm'] = 'native';
559-
$config['native_algorithm'] = PASSWORD_ARGON2I;
559+
$config['native_algorithm'] = \PASSWORD_ARGON2I;
560560
} else {
561561
throw new InvalidConfigurationException(sprintf('Algorithm "argon2i" is not available. Either use "%s" or upgrade to PHP 7.2+ instead.', \defined('SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13') ? 'argon2id", "auto' : 'auto'));
562562
}
@@ -569,7 +569,7 @@ private function createEncoder(array $config)
569569
$config['algorithm'] = 'sodium';
570570
} elseif (\defined('PASSWORD_ARGON2ID')) {
571571
$config['algorithm'] = 'native';
572-
$config['native_algorithm'] = PASSWORD_ARGON2ID;
572+
$config['native_algorithm'] = \PASSWORD_ARGON2ID;
573573
} else {
574574
throw new InvalidConfigurationException(sprintf('Algorithm "argon2id" is not available. Either use "%s", upgrade to PHP 7.3+ or use libsodium 1.0.15+ instead.', \defined('PASSWORD_ARGON2I') || $hasSodium ? 'argon2i", "auto' : 'auto'));
575575
}
@@ -793,7 +793,7 @@ private function isValidIp(string $cidr): bool
793793
$cidrParts = explode('/', $cidr);
794794

795795
if (1 === \count($cidrParts)) {
796-
return false !== filter_var($cidrParts[0], FILTER_VALIDATE_IP);
796+
return false !== filter_var($cidrParts[0], \FILTER_VALIDATE_IP);
797797
}
798798

799799
$ip = $cidrParts[0];
@@ -803,11 +803,11 @@ private function isValidIp(string $cidr): bool
803803
return false;
804804
}
805805

806-
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
806+
if (filter_var($ip, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV4)) {
807807
return $netmask <= 32;
808808
}
809809

810-
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
810+
if (filter_var($ip, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV6)) {
811811
return $netmask <= 128;
812812
}
813813

Security/FirewallContext.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function __construct(iterable $listeners, ExceptionListener $exceptionLis
3636
$this->exceptionListener = $exceptionListener;
3737
if ($logoutListener instanceof FirewallConfig) {
3838
$this->config = $logoutListener;
39-
@trigger_error(sprintf('Passing an instance of %s as the 3rd argument to "%s()" is deprecated since Symfony 4.2. Pass a %s instance instead.', FirewallConfig::class, __METHOD__, LogoutListener::class), E_USER_DEPRECATED);
39+
@trigger_error(sprintf('Passing an instance of %s as the 3rd argument to "%s()" is deprecated since Symfony 4.2. Pass a %s instance instead.', FirewallConfig::class, __METHOD__, LogoutListener::class), \E_USER_DEPRECATED);
4040
} elseif (null === $logoutListener || $logoutListener instanceof LogoutListener) {
4141
$this->logoutListener = $logoutListener;
4242
$this->config = $config;

Security/LazyFirewallContext.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function __invoke(RequestEvent $event)
4747

4848
foreach (parent::getListeners() as $listener) {
4949
if (!\is_callable($listener)) {
50-
@trigger_error(sprintf('Calling the "%s::handle()" method from the firewall is deprecated since Symfony 4.3, extend "%s" instead.', \get_class($listener), AbstractListener::class), E_USER_DEPRECATED);
50+
@trigger_error(sprintf('Calling the "%s::handle()" method from the firewall is deprecated since Symfony 4.3, extend "%s" instead.', \get_class($listener), AbstractListener::class), \E_USER_DEPRECATED);
5151
$listeners[] = [$listener, 'handle'];
5252
$lazy = false;
5353
} elseif (!$lazy || !$listener instanceof AbstractListener) {

SecurityUserValueResolver.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\Http\Controller\UserValueResolver;
2121

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

2424
/**
2525
* Supports the argument type of {@see UserInterface}.

Templating/Helper/LogoutUrlHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace Symfony\Bundle\SecurityBundle\Templating\Helper;
1313

14-
@trigger_error('The '.LogoutUrlHelper::class.' class is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.', E_USER_DEPRECATED);
14+
@trigger_error('The '.LogoutUrlHelper::class.' class is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.', \E_USER_DEPRECATED);
1515

1616
use Symfony\Component\Security\Http\Logout\LogoutUrlGenerator;
1717
use Symfony\Component\Templating\Helper\Helper;

Templating/Helper/SecurityHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace Symfony\Bundle\SecurityBundle\Templating\Helper;
1313

14-
@trigger_error('The '.SecurityHelper::class.' class is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.', E_USER_DEPRECATED);
14+
@trigger_error('The '.SecurityHelper::class.' class is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.', \E_USER_DEPRECATED);
1515

1616
use Symfony\Component\Security\Acl\Voter\FieldVote;
1717
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;

Tests/DependencyInjection/CompleteConfigurationTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ public function testEncodersWithArgon2i()
440440
],
441441
'JMS\FooBundle\Entity\User7' => [
442442
'class' => $sodium ? SodiumPasswordEncoder::class : NativePasswordEncoder::class,
443-
'arguments' => $sodium ? [256, 1] : [1, 262144, null, PASSWORD_ARGON2I],
443+
'arguments' => $sodium ? [256, 1] : [1, 262144, null, \PASSWORD_ARGON2I],
444444
],
445445
]], $container->getDefinition('security.encoder_factory.generic')->getArguments());
446446
}
@@ -555,7 +555,7 @@ public function testEncodersWithBCrypt()
555555
],
556556
'JMS\FooBundle\Entity\User7' => [
557557
'class' => NativePasswordEncoder::class,
558-
'arguments' => [null, null, 15, PASSWORD_BCRYPT],
558+
'arguments' => [null, null, 15, \PASSWORD_BCRYPT],
559559
],
560560
]], $container->getDefinition('security.encoder_factory.generic')->getArguments());
561561
}

Tests/Functional/UserPasswordEncoderCommandTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function testEncodePasswordEmptySalt()
3838
'user-class' => 'Symfony\Component\Security\Core\User\User',
3939
'--empty-salt' => true,
4040
], ['decorated' => false]);
41-
$expected = str_replace("\n", PHP_EOL, file_get_contents(__DIR__.'/app/PasswordEncode/emptysalt.txt'));
41+
$expected = str_replace("\n", \PHP_EOL, file_get_contents(__DIR__.'/app/PasswordEncode/emptysalt.txt'));
4242

4343
$this->assertEquals($expected, $this->passwordEncoderCommandTester->getDisplay());
4444
}
@@ -65,7 +65,7 @@ public function testEncodePasswordBcrypt()
6565
$output = $this->passwordEncoderCommandTester->getDisplay();
6666
$this->assertStringContainsString('Password encoding succeeded', $output);
6767

68-
$encoder = new NativePasswordEncoder(null, null, 17, PASSWORD_BCRYPT);
68+
$encoder = new NativePasswordEncoder(null, null, 17, \PASSWORD_BCRYPT);
6969
preg_match('# Encoded password\s{1,}([\w+\/$.]+={0,2})\s+#', $output, $matches);
7070
$hash = $matches[1];
7171
$this->assertTrue($encoder->isPasswordValid($hash, 'password', null));
@@ -86,7 +86,7 @@ public function testEncodePasswordArgon2i()
8686
$output = $this->passwordEncoderCommandTester->getDisplay();
8787
$this->assertStringContainsString('Password encoding succeeded', $output);
8888

89-
$encoder = $sodium ? new SodiumPasswordEncoder() : new NativePasswordEncoder(null, null, null, PASSWORD_ARGON2I);
89+
$encoder = $sodium ? new SodiumPasswordEncoder() : new NativePasswordEncoder(null, null, null, \PASSWORD_ARGON2I);
9090
preg_match('# Encoded password\s+(\$argon2i?\$[\w,=\$+\/]+={0,2})\s+#', $output, $matches);
9191
$hash = $matches[1];
9292
$this->assertTrue($encoder->isPasswordValid($hash, 'password', null));
@@ -107,7 +107,7 @@ public function testEncodePasswordArgon2id()
107107
$output = $this->passwordEncoderCommandTester->getDisplay();
108108
$this->assertStringContainsString('Password encoding succeeded', $output);
109109

110-
$encoder = $sodium ? new SodiumPasswordEncoder() : new NativePasswordEncoder(null, null, null, PASSWORD_ARGON2ID);
110+
$encoder = $sodium ? new SodiumPasswordEncoder() : new NativePasswordEncoder(null, null, null, \PASSWORD_ARGON2ID);
111111
preg_match('# Encoded password\s+(\$argon2id?\$[\w,=\$+\/]+={0,2})\s+#', $output, $matches);
112112
$hash = $matches[1];
113113
$this->assertTrue($encoder->isPasswordValid($hash, 'password', null));
@@ -314,7 +314,7 @@ public function testThrowsExceptionOnNoConfiguredEncoders()
314314

315315
protected function setUp(): void
316316
{
317-
putenv('COLUMNS='.(119 + \strlen(PHP_EOL)));
317+
putenv('COLUMNS='.(119 + \strlen(\PHP_EOL)));
318318
$kernel = $this->createKernel(['test_case' => 'PasswordEncode']);
319319
$kernel->boot();
320320

@@ -332,7 +332,7 @@ protected function tearDown(): void
332332

333333
private function setupArgon2i()
334334
{
335-
putenv('COLUMNS='.(119 + \strlen(PHP_EOL)));
335+
putenv('COLUMNS='.(119 + \strlen(\PHP_EOL)));
336336
$kernel = $this->createKernel(['test_case' => 'PasswordEncode', 'root_config' => 'argon2i.yml']);
337337
$kernel->boot();
338338

@@ -345,7 +345,7 @@ private function setupArgon2i()
345345

346346
private function setupArgon2id()
347347
{
348-
putenv('COLUMNS='.(119 + \strlen(PHP_EOL)));
348+
putenv('COLUMNS='.(119 + \strlen(\PHP_EOL)));
349349
$kernel = $this->createKernel(['test_case' => 'PasswordEncode', 'root_config' => 'argon2id.yml']);
350350
$kernel->boot();
351351

@@ -358,7 +358,7 @@ private function setupArgon2id()
358358

359359
private function setupBcrypt()
360360
{
361-
putenv('COLUMNS='.(119 + \strlen(PHP_EOL)));
361+
putenv('COLUMNS='.(119 + \strlen(\PHP_EOL)));
362362
$kernel = $this->createKernel(['test_case' => 'PasswordEncode', 'root_config' => 'bcrypt.yml']);
363363
$kernel->boot();
364364

@@ -371,7 +371,7 @@ private function setupBcrypt()
371371

372372
private function setupSodium()
373373
{
374-
putenv('COLUMNS='.(119 + \strlen(PHP_EOL)));
374+
putenv('COLUMNS='.(119 + \strlen(\PHP_EOL)));
375375
$kernel = $this->createKernel(['test_case' => 'PasswordEncode', 'root_config' => 'sodium.yml']);
376376
$kernel->boot();
377377

0 commit comments

Comments
 (0)