Skip to content

Commit b020a01

Browse files
authored
Merge pull request #3077 from stof/bump_min_version
Bump min versions to Symfony 6.4 and PHP 8.1
2 parents 095260b + 431db88 commit b020a01

22 files changed

+33
-321
lines changed

.github/workflows/ci.yaml

-8
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,11 @@ jobs:
1515
fail-fast: false
1616
matrix:
1717
php:
18-
- '7.4'
19-
- '8.0'
2018
- '8.1'
2119
- '8.2'
2220
- '8.3'
2321
symfony-versions: [false]
2422
include:
25-
- description: 'Symfony 4.*'
26-
php: '7.4'
27-
symfony-versions: '^4.4'
28-
- description: 'Symfony 5.*'
29-
php: '8.1'
30-
symfony-versions: '^5.4'
3123
- description: 'Symfony 6.*'
3224
php: '8.2'
3325
symfony-versions: '^6.4'

composer.json

+23-22
Original file line numberDiff line numberDiff line change
@@ -21,41 +21,42 @@
2121
}
2222
],
2323
"require": {
24-
"php": "^7.4 || ^8.0",
24+
"php": "^8.1",
2525
"ext-dom": "*",
2626
"ext-json": "*",
27-
"symfony/config": "^4.4 || ^5.0 || ^6.0 || ^7.0",
28-
"symfony/dependency-injection": "^4.4 || ^5.0 || ^6.0 || ^7.0",
27+
"symfony/config": "^6.4 || ^7.0",
28+
"symfony/dependency-injection": "^6.4 || ^7.0",
2929
"symfony/deprecation-contracts": "^2.5 || ^3.5",
30-
"symfony/event-dispatcher": "^4.4 || ^5.0 || ^6.0 || ^7.0",
30+
"symfony/event-dispatcher": "^6.4 || ^7.0",
3131
"symfony/event-dispatcher-contracts": "^1.1 || ^2.0 || ^3.0",
32-
"symfony/form": "^4.4 || ^5.0 || ^6.0 || ^7.0",
33-
"symfony/framework-bundle": "^4.4 || ^5.0 || ^6.0 || ^7.0",
34-
"symfony/http-foundation": "^4.4 || ^5.0 || ^6.0 || ^7.0",
35-
"symfony/http-kernel": "^4.4 || ^5.0 || ^6.0 || ^7.0",
36-
"symfony/options-resolver": "^4.4 || ^5.0 || ^6.0 || ^7.0",
37-
"symfony/routing": "^4.4 || ^5.0 || ^6.0 || ^7.0",
38-
"symfony/security-bundle": "^4.4 || ^5.0 || ^6.0 || ^7.0",
39-
"symfony/security-core": "^4.4 || ^5.0 || ^6.0 || ^7.0",
40-
"symfony/translation": "^4.4 || ^5.0 || ^6.0 || ^7.0",
41-
"symfony/twig-bundle": "^4.4 || ^5.0 || ^6.0 || ^7.0",
42-
"symfony/validator": "^4.4 || ^5.0 || ^6.0 || ^7.0",
43-
"twig/twig": "^1.34 || ^2.4 || ^3.0"
32+
"symfony/form": "^6.4 || ^7.0",
33+
"symfony/framework-bundle": "^6.4 || ^7.0",
34+
"symfony/http-foundation": "^6.4 || ^7.0",
35+
"symfony/http-kernel": "^6.4 || ^7.0",
36+
"symfony/options-resolver": "^6.4 || ^7.0",
37+
"symfony/password-hasher": "^6.4 || ^7.0",
38+
"symfony/routing": "^6.4 || ^7.0",
39+
"symfony/security-bundle": "^6.4 || ^7.0",
40+
"symfony/security-core": "^6.4 || ^7.0",
41+
"symfony/translation": "^6.4 || ^7.0",
42+
"symfony/twig-bundle": "^6.4 || ^7.0",
43+
"symfony/validator": "^6.4 || ^7.0",
44+
"twig/twig": "^2.13 || ^3.0"
4445
},
4546
"conflict": {
4647
"doctrine/doctrine-bundle": "<1.3",
4748
"doctrine/persistence": "<1.3",
48-
"symfony/doctrine-bridge": "<4.4"
49+
"symfony/doctrine-bridge": "<6.4"
4950
},
5051
"require-dev": {
5152
"doctrine/doctrine-bundle": "^1.3 || ^2",
5253
"friendsofphp/php-cs-fixer": "^3.0.2, !=3.5.0",
5354
"swiftmailer/swiftmailer": "^4.3 || ^5.0 || ^6.0",
54-
"symfony/console": "^4.4 || ^5.0 || ^6.0 || ^7.0",
55-
"symfony/mailer": "^4.4 || ^5.0 || ^6.0 || ^7.0",
56-
"symfony/mime": "^4.4 || ^5.0 || ^6.0 || ^7.0",
57-
"symfony/phpunit-bridge": "^6.1",
58-
"symfony/yaml": "^4.4 || ^5.0 || ^6.0 || ^7.0"
55+
"symfony/console": "^6.4 || ^7.0",
56+
"symfony/mailer": "^6.4 || ^7.0",
57+
"symfony/mime": "^6.4 || ^7.0",
58+
"symfony/phpunit-bridge": "^6.4 || ^7.0",
59+
"symfony/yaml": "^6.4 || ^7.0"
5960
},
6061
"config": {
6162
"sort-packages": true

src/Command/ActivateUserCommand.php

-6
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@
2828
#[AsCommand(name: 'fos:user:activate', description: 'Activate a user')]
2929
final class ActivateUserCommand extends Command
3030
{
31-
// BC with Symfony <5.3
32-
protected static $defaultName = 'fos:user:activate';
33-
3431
private $userManipulator;
3532

3633
public function __construct(UserManipulator $userManipulator)
@@ -43,9 +40,6 @@ public function __construct(UserManipulator $userManipulator)
4340
protected function configure(): void
4441
{
4542
$this
46-
// BC with Symfony <5.3
47-
->setName('fos:user:activate')
48-
->setDescription('Activate a user')
4943
->setDefinition([
5044
new InputArgument('username', InputArgument::REQUIRED, 'The username'),
5145
])

src/Command/ChangePasswordCommand.php

-6
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@
2626
#[AsCommand(name: 'fos:user:change-password', description: 'Change the password of a user.')]
2727
final class ChangePasswordCommand extends Command
2828
{
29-
// BC with Symfony <5.3
30-
protected static $defaultName = 'fos:user:change-password';
31-
3229
private $userManipulator;
3330

3431
public function __construct(UserManipulator $userManipulator)
@@ -41,9 +38,6 @@ public function __construct(UserManipulator $userManipulator)
4138
protected function configure(): void
4239
{
4340
$this
44-
// BC with Symfony <5.3
45-
->setName('fos:user:change-password')
46-
->setDescription('Change the password of a user.')
4741
->setDefinition([
4842
new InputArgument('username', InputArgument::REQUIRED, 'The username'),
4943
new InputArgument('password', InputArgument::REQUIRED, 'The password'),

src/Command/CreateUserCommand.php

-6
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@
3131
#[AsCommand(name: 'fos:user:create', description: 'Create a user.')]
3232
final class CreateUserCommand extends Command
3333
{
34-
// BC with Symfony <5.3
35-
protected static $defaultName = 'fos:user:create';
36-
3734
private $userManipulator;
3835

3936
public function __construct(UserManipulator $userManipulator)
@@ -46,9 +43,6 @@ public function __construct(UserManipulator $userManipulator)
4643
protected function configure(): void
4744
{
4845
$this
49-
// BC with Symfony <5.3
50-
->setName('fos:user:create')
51-
->setDescription('Create a user.')
5246
->setDefinition([
5347
new InputArgument('username', InputArgument::REQUIRED, 'The username'),
5448
new InputArgument('email', InputArgument::REQUIRED, 'The email'),

src/Command/DeactivateUserCommand.php

-6
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@
2828
#[AsCommand(name: 'fos:user:deactivate', description: 'Deactivate a user')]
2929
final class DeactivateUserCommand extends Command
3030
{
31-
// BC with Symfony <5.3
32-
protected static $defaultName = 'fos:user:deactivate';
33-
3431
private $userManipulator;
3532

3633
public function __construct(UserManipulator $userManipulator)
@@ -43,9 +40,6 @@ public function __construct(UserManipulator $userManipulator)
4340
protected function configure(): void
4441
{
4542
$this
46-
// BC with Symfony <5.3
47-
->setName('fos:user:deactivate')
48-
->setDescription('Deactivate a user')
4943
->setDefinition([
5044
new InputArgument('username', InputArgument::REQUIRED, 'The username'),
5145
])

src/Command/DemoteUserCommand.php

-6
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,11 @@
2424
#[AsCommand(name: 'fos:user:demote', description: 'Demote a user by removing a role')]
2525
final class DemoteUserCommand extends RoleCommand
2626
{
27-
// BC with Symfony <5.3
28-
protected static $defaultName = 'fos:user:demote';
29-
3027
protected function configure(): void
3128
{
3229
parent::configure();
3330

3431
$this
35-
// BC with Symfony <5.3
36-
->setName('fos:user:demote')
37-
->setDescription('Demote a user by removing a role')
3832
->setHelp(<<<'EOT'
3933
The <info>fos:user:demote</info> command demotes a user by removing a role
4034

src/Command/PromoteUserCommand.php

-6
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,11 @@
2626
#[AsCommand(name: 'fos:user:promote', description: 'Promotes a user by adding a role')]
2727
final class PromoteUserCommand extends RoleCommand
2828
{
29-
// BC with Symfony <5.3
30-
protected static $defaultName = 'fos:user:promote';
31-
3229
protected function configure(): void
3330
{
3431
parent::configure();
3532

3633
$this
37-
// BC with Symfony <5.3
38-
->setName('fos:user:promote')
39-
->setDescription('Promotes a user by adding a role')
4034
->setHelp(<<<'EOT'
4135
The <info>fos:user:promote</info> command promotes a user by adding a role
4236

src/CompatibilityUtil.php

-35
This file was deleted.

src/Controller/ChangePasswordController.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace FOS\UserBundle\Controller;
1313

14-
use FOS\UserBundle\CompatibilityUtil;
1514
use FOS\UserBundle\Event\FilterUserResponseEvent;
1615
use FOS\UserBundle\Event\FormEvent;
1716
use FOS\UserBundle\Event\GetResponseUserEvent;
@@ -40,7 +39,7 @@ final class ChangePasswordController extends AbstractController
4039

4140
public function __construct(EventDispatcherInterface $eventDispatcher, FactoryInterface $formFactory, UserManagerInterface $userManager)
4241
{
43-
$this->eventDispatcher = CompatibilityUtil::upgradeEventDispatcher($eventDispatcher);
42+
$this->eventDispatcher = $eventDispatcher;
4443
$this->formFactory = $formFactory;
4544
$this->userManager = $userManager;
4645
}

src/Controller/ProfileController.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace FOS\UserBundle\Controller;
1313

14-
use FOS\UserBundle\CompatibilityUtil;
1514
use FOS\UserBundle\Event\FilterUserResponseEvent;
1615
use FOS\UserBundle\Event\FormEvent;
1716
use FOS\UserBundle\Event\GetResponseUserEvent;
@@ -39,7 +38,7 @@ final class ProfileController extends AbstractController
3938

4039
public function __construct(EventDispatcherInterface $eventDispatcher, FactoryInterface $formFactory, UserManagerInterface $userManager)
4140
{
42-
$this->eventDispatcher = CompatibilityUtil::upgradeEventDispatcher($eventDispatcher);
41+
$this->eventDispatcher = $eventDispatcher;
4342
$this->formFactory = $formFactory;
4443
$this->userManager = $userManager;
4544
}

src/Controller/RegistrationController.php

+1-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace FOS\UserBundle\Controller;
1313

14-
use FOS\UserBundle\CompatibilityUtil;
1514
use FOS\UserBundle\Event\FilterUserResponseEvent;
1615
use FOS\UserBundle\Event\FormEvent;
1716
use FOS\UserBundle\Event\GetResponseUserEvent;
@@ -43,7 +42,7 @@ final class RegistrationController extends AbstractController
4342

4443
public function __construct(EventDispatcherInterface $eventDispatcher, FactoryInterface $formFactory, UserManagerInterface $userManager, TokenStorageInterface $tokenStorage)
4544
{
46-
$this->eventDispatcher = CompatibilityUtil::upgradeEventDispatcher($eventDispatcher);
45+
$this->eventDispatcher = $eventDispatcher;
4746
$this->formFactory = $formFactory;
4847
$this->userManager = $userManager;
4948
$this->tokenStorage = $tokenStorage;
@@ -178,9 +177,6 @@ private function getTargetUrlFromSession(SessionInterface $session): ?string
178177

179178
if (method_exists($token, 'getFirewallName')) {
180179
$firewallName = $token->getFirewallName();
181-
} elseif (method_exists($token, 'getProviderKey')) {
182-
// BC with Symfony 5.x
183-
$firewallName = $token->getProviderKey();
184180
} else {
185181
return null;
186182
}

src/Controller/ResettingController.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace FOS\UserBundle\Controller;
1313

14-
use FOS\UserBundle\CompatibilityUtil;
1514
use FOS\UserBundle\Event\FilterUserResponseEvent;
1615
use FOS\UserBundle\Event\FormEvent;
1716
use FOS\UserBundle\Event\GetResponseNullableUserEvent;
@@ -51,7 +50,7 @@ final class ResettingController extends AbstractController
5150
*/
5251
public function __construct(EventDispatcherInterface $eventDispatcher, FactoryInterface $formFactory, UserManagerInterface $userManager, TokenGeneratorInterface $tokenGenerator, MailerInterface $mailer, $retryTtl)
5352
{
54-
$this->eventDispatcher = CompatibilityUtil::upgradeEventDispatcher($eventDispatcher);
53+
$this->eventDispatcher = $eventDispatcher;
5554
$this->formFactory = $formFactory;
5655
$this->userManager = $userManager;
5756
$this->tokenGenerator = $tokenGenerator;

src/DependencyInjection/Compiler/ConfigurePasswordHasherPass.php

-36
This file was deleted.

src/DependencyInjection/Compiler/InjectRememberMeServicesPass.php

-4
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@ public function process(ContainerBuilder $container): void
3232

3333
if ($container->has('security.authenticator.remember_me_handler.'.$firewallName)) {
3434
$loginManager->replaceArgument(4, new Reference('security.authenticator.remember_me_handler.'.$firewallName));
35-
} elseif ($container->hasDefinition('security.authentication.rememberme.services.persistent.'.$firewallName)) {
36-
$loginManager->replaceArgument(4, new Reference('security.authentication.rememberme.services.persistent.'.$firewallName));
37-
} elseif ($container->hasDefinition('security.authentication.rememberme.services.simplehash.'.$firewallName)) {
38-
$loginManager->replaceArgument(4, new Reference('security.authentication.rememberme.services.simplehash.'.$firewallName));
3935
}
4036
}
4137
}

src/EventListener/AuthenticationListener.php

-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace FOS\UserBundle\EventListener;
1313

14-
use FOS\UserBundle\CompatibilityUtil;
1514
use FOS\UserBundle\Event\FilterUserResponseEvent;
1615
use FOS\UserBundle\Event\UserEvent;
1716
use FOS\UserBundle\FOSUserEvents;
@@ -62,7 +61,6 @@ public static function getSubscribedEvents(): array
6261
*/
6362
public function authenticate(FilterUserResponseEvent $event, $eventName, EventDispatcherInterface $eventDispatcher)
6463
{
65-
$eventDispatcher = CompatibilityUtil::upgradeEventDispatcher($eventDispatcher);
6664
try {
6765
$this->loginManager->logInUser($this->firewallName, $event->getUser(), $event->getResponse());
6866

src/FOSUserBundle.php

-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
use Doctrine\Bundle\MongoDBBundle\DependencyInjection\Compiler\DoctrineMongoDBMappingsPass;
1616
use FOS\UserBundle\DependencyInjection\Compiler\CheckForSessionPass;
1717
use FOS\UserBundle\DependencyInjection\Compiler\CheckForSwiftMailerPass;
18-
use FOS\UserBundle\DependencyInjection\Compiler\ConfigurePasswordHasherPass;
1918
use FOS\UserBundle\DependencyInjection\Compiler\InjectRememberMeServicesPass;
2019
use FOS\UserBundle\DependencyInjection\Compiler\InjectUserCheckerPass;
2120
use FOS\UserBundle\DependencyInjection\Compiler\ValidationPass;
@@ -31,7 +30,6 @@ final class FOSUserBundle extends Bundle
3130
public function build(ContainerBuilder $container): void
3231
{
3332
parent::build($container);
34-
$container->addCompilerPass(new ConfigurePasswordHasherPass());
3533
$container->addCompilerPass(new ValidationPass());
3634
$container->addCompilerPass(new InjectUserCheckerPass());
3735
$container->addCompilerPass(new InjectRememberMeServicesPass());

0 commit comments

Comments
 (0)