Skip to content

Commit e8e6ed3

Browse files
authored
Merge pull request #3057 from stof/fix_deprecations
Fix deprecations
2 parents 6a6a32e + e708d65 commit e8e6ed3

18 files changed

+50
-38
lines changed

Command/ActivateUserCommand.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function __construct(UserManipulator $userManipulator)
4141
$this->userManipulator = $userManipulator;
4242
}
4343

44-
protected function configure()
44+
protected function configure(): void
4545
{
4646
$this
4747
// BC with Symfony <5.3
@@ -69,7 +69,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
6969
return 0;
7070
}
7171

72-
protected function interact(InputInterface $input, OutputInterface $output)
72+
protected function interact(InputInterface $input, OutputInterface $output): void
7373
{
7474
if (!$input->getArgument('username')) {
7575
$question = new Question('Please choose a username:');

Command/ChangePasswordCommand.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function __construct(UserManipulator $userManipulator)
3939
$this->userManipulator = $userManipulator;
4040
}
4141

42-
protected function configure()
42+
protected function configure(): void
4343
{
4444
$this
4545
// BC with Symfony <5.3
@@ -76,7 +76,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
7676
return 0;
7777
}
7878

79-
protected function interact(InputInterface $input, OutputInterface $output)
79+
protected function interact(InputInterface $input, OutputInterface $output): void
8080
{
8181
$questions = [];
8282

Command/CreateUserCommand.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function __construct(UserManipulator $userManipulator)
4444
$this->userManipulator = $userManipulator;
4545
}
4646

47-
protected function configure()
47+
protected function configure(): void
4848
{
4949
$this
5050
// BC with Symfony <5.3
@@ -95,7 +95,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
9595
return 0;
9696
}
9797

98-
protected function interact(InputInterface $input, OutputInterface $output)
98+
protected function interact(InputInterface $input, OutputInterface $output): void
9999
{
100100
$questions = [];
101101

Command/DeactivateUserCommand.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function __construct(UserManipulator $userManipulator)
4141
$this->userManipulator = $userManipulator;
4242
}
4343

44-
protected function configure()
44+
protected function configure(): void
4545
{
4646
$this
4747
// BC with Symfony <5.3
@@ -69,7 +69,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
6969
return 0;
7070
}
7171

72-
protected function interact(InputInterface $input, OutputInterface $output)
72+
protected function interact(InputInterface $input, OutputInterface $output): void
7373
{
7474
if (!$input->getArgument('username')) {
7575
$question = new Question('Please choose a username:');

Command/DemoteUserCommand.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class DemoteUserCommand extends RoleCommand
2929
// BC with Symfony <5.3
3030
protected static $defaultName = 'fos:user:demote';
3131

32-
protected function configure()
32+
protected function configure(): void
3333
{
3434
parent::configure();
3535

@@ -46,7 +46,7 @@ protected function configure()
4646
);
4747
}
4848

49-
protected function executeRoleCommand(UserManipulator $manipulator, OutputInterface $output, $username, $super, $role)
49+
protected function executeRoleCommand(UserManipulator $manipulator, OutputInterface $output, $username, $super, $role): void
5050
{
5151
if ($super) {
5252
$manipulator->demote($username);

Command/PromoteUserCommand.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class PromoteUserCommand extends RoleCommand
3131
// BC with Symfony <5.3
3232
protected static $defaultName = 'fos:user:promote';
3333

34-
protected function configure()
34+
protected function configure(): void
3535
{
3636
parent::configure();
3737

@@ -48,7 +48,7 @@ protected function configure()
4848
);
4949
}
5050

51-
protected function executeRoleCommand(UserManipulator $manipulator, OutputInterface $output, $username, $super, $role)
51+
protected function executeRoleCommand(UserManipulator $manipulator, OutputInterface $output, $username, $super, $role): void
5252
{
5353
if ($super) {
5454
$manipulator->promote($username);

Command/RoleCommand.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function __construct(UserManipulator $userManipulator)
3535
$this->userManipulator = $userManipulator;
3636
}
3737

38-
protected function configure()
38+
protected function configure(): void
3939
{
4040
$this
4141
->setDefinition([
@@ -72,9 +72,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
7272
* @param bool $super
7373
* @param string $role
7474
*/
75-
abstract protected function executeRoleCommand(UserManipulator $manipulator, OutputInterface $output, $username, $super, $role);
75+
abstract protected function executeRoleCommand(UserManipulator $manipulator, OutputInterface $output, $username, $super, $role): void;
7676

77-
protected function interact(InputInterface $input, OutputInterface $output)
77+
protected function interact(InputInterface $input, OutputInterface $output): void
7878
{
7979
$questions = [];
8080

DependencyInjection/Configuration.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function getConfigTreeBuilder(): TreeBuilder
8181
return $treeBuilder;
8282
}
8383

84-
private function addProfileSection(ArrayNodeDefinition $node)
84+
private function addProfileSection(ArrayNodeDefinition $node): void
8585
{
8686
$node
8787
->children()
@@ -106,7 +106,7 @@ private function addProfileSection(ArrayNodeDefinition $node)
106106
->end();
107107
}
108108

109-
private function addRegistrationSection(ArrayNodeDefinition $node)
109+
private function addRegistrationSection(ArrayNodeDefinition $node): void
110110
{
111111
$node
112112
->children()
@@ -144,7 +144,7 @@ private function addRegistrationSection(ArrayNodeDefinition $node)
144144
->end();
145145
}
146146

147-
private function addResettingSection(ArrayNodeDefinition $node)
147+
private function addResettingSection(ArrayNodeDefinition $node): void
148148
{
149149
$node
150150
->children()
@@ -183,7 +183,7 @@ private function addResettingSection(ArrayNodeDefinition $node)
183183
->end();
184184
}
185185

186-
private function addChangePasswordSection(ArrayNodeDefinition $node)
186+
private function addChangePasswordSection(ArrayNodeDefinition $node): void
187187
{
188188
$node
189189
->children()
@@ -207,7 +207,7 @@ private function addChangePasswordSection(ArrayNodeDefinition $node)
207207
->end();
208208
}
209209

210-
private function addServiceSection(ArrayNodeDefinition $node)
210+
private function addServiceSection(ArrayNodeDefinition $node): void
211211
{
212212
$node
213213
->addDefaultsIfNotSet()

DependencyInjection/FOSUserExtension.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class FOSUserExtension extends Extension
4949
private $mailerNeeded = false;
5050
private $sessionNeeded = false;
5151

52-
public function load(array $configs, ContainerBuilder $container)
52+
public function load(array $configs, ContainerBuilder $container): void
5353
{
5454
$processor = new Processor();
5555
$configuration = new Configuration();
@@ -151,7 +151,7 @@ public function getNamespace(): string
151151
return 'http://friendsofsymfony.github.io/schema/dic/user';
152152
}
153153

154-
protected function remapParameters(array $config, ContainerBuilder $container, array $map)
154+
protected function remapParameters(array $config, ContainerBuilder $container, array $map): void
155155
{
156156
foreach ($map as $name => $paramName) {
157157
if (array_key_exists($name, $config)) {
@@ -160,7 +160,7 @@ protected function remapParameters(array $config, ContainerBuilder $container, a
160160
}
161161
}
162162

163-
protected function remapParametersNamespaces(array $config, ContainerBuilder $container, array $namespaces)
163+
protected function remapParametersNamespaces(array $config, ContainerBuilder $container, array $namespaces): void
164164
{
165165
foreach ($namespaces as $ns => $map) {
166166
if ($ns) {
@@ -181,7 +181,7 @@ protected function remapParametersNamespaces(array $config, ContainerBuilder $co
181181
}
182182
}
183183

184-
private function loadProfile(array $config, ContainerBuilder $container, XmlFileLoader $loader)
184+
private function loadProfile(array $config, ContainerBuilder $container, XmlFileLoader $loader): void
185185
{
186186
$loader->load('profile.xml');
187187

@@ -190,7 +190,7 @@ private function loadProfile(array $config, ContainerBuilder $container, XmlFile
190190
]);
191191
}
192192

193-
private function loadRegistration(array $config, ContainerBuilder $container, XmlFileLoader $loader, array $fromEmail)
193+
private function loadRegistration(array $config, ContainerBuilder $container, XmlFileLoader $loader, array $fromEmail): void
194194
{
195195
$loader->load('registration.xml');
196196
$this->sessionNeeded = true;
@@ -213,7 +213,7 @@ private function loadRegistration(array $config, ContainerBuilder $container, Xm
213213
]);
214214
}
215215

216-
private function loadChangePassword(array $config, ContainerBuilder $container, XmlFileLoader $loader)
216+
private function loadChangePassword(array $config, ContainerBuilder $container, XmlFileLoader $loader): void
217217
{
218218
$loader->load('change_password.xml');
219219

@@ -222,7 +222,7 @@ private function loadChangePassword(array $config, ContainerBuilder $container,
222222
]);
223223
}
224224

225-
private function loadResetting(array $config, ContainerBuilder $container, XmlFileLoader $loader, array $fromEmail)
225+
private function loadResetting(array $config, ContainerBuilder $container, XmlFileLoader $loader, array $fromEmail): void
226226
{
227227
$this->mailerNeeded = true;
228228
$loader->load('resetting.xml');

FOSUserBundle.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ private function addRegisterMappingsPass(ContainerBuilder $container)
5151
];
5252

5353
if (class_exists('Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass')) {
54-
$container->addCompilerPass(DoctrineOrmMappingsPass::createXmlMappingDriver($mappings, ['fos_user.model_manager_name'], 'fos_user.backend_type_orm'));
54+
$container->addCompilerPass(DoctrineOrmMappingsPass::createXmlMappingDriver($mappings, ['fos_user.model_manager_name'], 'fos_user.backend_type_orm', [], true));
5555
}
5656

5757
if (class_exists('Doctrine\Bundle\MongoDBBundle\DependencyInjection\Compiler\DoctrineMongoDBMappingsPass')) {

Form/Type/ChangePasswordFormType.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function __construct($class)
3737
$this->class = $class;
3838
}
3939

40-
public function buildForm(FormBuilderInterface $builder, array $options)
40+
public function buildForm(FormBuilderInterface $builder, array $options): void
4141
{
4242
$constraintsOptions = [
4343
'message' => 'fos_user.current_password.invalid',
@@ -74,7 +74,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
7474
]);
7575
}
7676

77-
public function configureOptions(OptionsResolver $resolver)
77+
public function configureOptions(OptionsResolver $resolver): void
7878
{
7979
$resolver->setDefaults([
8080
'data_class' => $this->class,

Form/Type/ProfileFormType.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function __construct($class)
3737
$this->class = $class;
3838
}
3939

40-
public function buildForm(FormBuilderInterface $builder, array $options)
40+
public function buildForm(FormBuilderInterface $builder, array $options): void
4141
{
4242
$this->buildUserForm($builder, $options);
4343

@@ -63,7 +63,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
6363
]);
6464
}
6565

66-
public function configureOptions(OptionsResolver $resolver)
66+
public function configureOptions(OptionsResolver $resolver): void
6767
{
6868
$resolver->setDefaults([
6969
'data_class' => $this->class,
@@ -79,7 +79,7 @@ public function getBlockPrefix(): string
7979
/**
8080
* Builds the embedded form representing the user.
8181
*/
82-
protected function buildUserForm(FormBuilderInterface $builder, array $options)
82+
protected function buildUserForm(FormBuilderInterface $builder, array $options): void
8383
{
8484
$builder
8585
->add('username', null, ['label' => 'form.username', 'translation_domain' => 'FOSUserBundle'])

Form/Type/RegistrationFormType.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function __construct($class)
3636
$this->class = $class;
3737
}
3838

39-
public function buildForm(FormBuilderInterface $builder, array $options)
39+
public function buildForm(FormBuilderInterface $builder, array $options): void
4040
{
4141
$builder
4242
->add('email', EmailType::class, ['label' => 'form.email', 'translation_domain' => 'FOSUserBundle'])
@@ -56,7 +56,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
5656
;
5757
}
5858

59-
public function configureOptions(OptionsResolver $resolver)
59+
public function configureOptions(OptionsResolver $resolver): void
6060
{
6161
$resolver->setDefaults([
6262
'data_class' => $this->class,

Form/Type/ResettingFormType.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function __construct($class)
3535
$this->class = $class;
3636
}
3737

38-
public function buildForm(FormBuilderInterface $builder, array $options)
38+
public function buildForm(FormBuilderInterface $builder, array $options): void
3939
{
4040
$builder->add('plainPassword', RepeatedType::class, [
4141
'type' => PasswordType::class,
@@ -51,7 +51,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
5151
]);
5252
}
5353

54-
public function configureOptions(OptionsResolver $resolver)
54+
public function configureOptions(OptionsResolver $resolver): void
5555
{
5656
$resolver->setDefaults([
5757
'data_class' => $this->class,

Form/Type/UsernameFormType.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function __construct(UserToUsernameTransformer $usernameTransformer)
3838
$this->usernameTransformer = $usernameTransformer;
3939
}
4040

41-
public function buildForm(FormBuilderInterface $builder, array $options)
41+
public function buildForm(FormBuilderInterface $builder, array $options): void
4242
{
4343
$builder->addModelTransformer($this->usernameTransformer);
4444
}

Model/User.php

+3
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,9 @@ public function addRole($role)
180180
return $this;
181181
}
182182

183+
/**
184+
* @return void
185+
*/
183186
public function eraseCredentials()
184187
{
185188
$this->plainPassword = null;

Security/UserChecker.php

+6
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
*/
2323
class UserChecker implements UserCheckerInterface
2424
{
25+
/**
26+
* @return void
27+
*/
2528
public function checkPreAuth(BaseUserInterface $user)
2629
{
2730
if (!$user->isEnabled()) {
@@ -31,6 +34,9 @@ public function checkPreAuth(BaseUserInterface $user)
3134
}
3235
}
3336

37+
/**
38+
* @return void
39+
*/
3440
public function checkPostAuth(BaseUserInterface $user)
3541
{
3642
}

Tests/Mailer/TwigSwiftMailerTest.php

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
use FOS\UserBundle\Mailer\TwigSwiftMailer;
1515
use PHPUnit\Framework\TestCase;
1616

17+
/**
18+
* @group legacy
19+
*/
1720
class TwigSwiftMailerTest extends TestCase
1821
{
1922
/**

0 commit comments

Comments
 (0)