Skip to content

Commit a9e71b6

Browse files
committed
Merge branch '2.x'
2 parents 1e932f6 + e65f975 commit a9e71b6

File tree

85 files changed

+451
-683
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+451
-683
lines changed

.php_cs.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ EOF;
1212
return PhpCsFixer\Config::create()
1313
->setRules([
1414
'@Symfony' => true,
15-
'array_syntax' => ['syntax' => 'long'],
15+
'array_syntax' => ['syntax' => 'short'],
1616
'combine_consecutive_unsets' => true,
1717
'header_comment' => ['header' => $header],
1818
'linebreak_after_opening_tag' => true,

Changelog.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
Changelog
22
=========
33

4-
### 2.1.3 (2018-xx-xx)
4+
### 2.2.0 (2020-01-xx)
5+
=======
56

7+
* Marked all controllers final.
68
* Added Mongolian translation.
9+
* Added an email provider.
10+
* Added a custom user checker.
11+
* Added PHP 7.3 support.
12+
* Removed fieldName attribute in MongoDB mapping.
13+
* Registration confirmation now redirects to login page if token is invalid.
14+
* User model will not rely on `AdvancedUserInterface` anymore.
15+
* Self-salting password encoders will not create a salt anymore.
16+
* FlashListener constructor now accepts `SessionInterface`.
17+
* Fixed `UserManagerInterface::updateUser` signature.
18+
* Fixed several Symfony deprecation notices.
19+
* Fixed several translations.
720

821
### 2.1.2 (2018-03-08)
922

Command/ActivateUserCommand.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ protected function configure()
4242
$this
4343
->setName('fos:user:activate')
4444
->setDescription('Activate a user')
45-
->setDefinition(array(
45+
->setDefinition([
4646
new InputArgument('username', InputArgument::REQUIRED, 'The username'),
47-
))
47+
])
4848
->setHelp(<<<'EOT'
4949
The <info>fos:user:activate</info> command activates a user (so they will be able to log in):
5050
@@ -63,6 +63,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
6363
$this->userManipulator->activate($username);
6464

6565
$output->writeln(sprintf('User "%s" has been activated.', $username));
66+
67+
return 0;
6668
}
6769

6870
/**

Command/ChangePasswordCommand.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ protected function configure()
3939
$this
4040
->setName('fos:user:change-password')
4141
->setDescription('Change the password of a user.')
42-
->setDefinition(array(
42+
->setDefinition([
4343
new InputArgument('username', InputArgument::REQUIRED, 'The username'),
4444
new InputArgument('password', InputArgument::REQUIRED, 'The password'),
45-
))
45+
])
4646
->setHelp(<<<'EOT'
4747
The <info>fos:user:change-password</info> command changes the password of a user:
4848
@@ -69,14 +69,16 @@ protected function execute(InputInterface $input, OutputInterface $output)
6969
$this->userManipulator->changePassword($username, $password);
7070

7171
$output->writeln(sprintf('Changed password for user <comment>%s</comment>', $username));
72+
73+
return 0;
7274
}
7375

7476
/**
7577
* {@inheritdoc}
7678
*/
7779
protected function interact(InputInterface $input, OutputInterface $output)
7880
{
79-
$questions = array();
81+
$questions = [];
8082

8183
if (!$input->getArgument('username')) {
8284
$question = new Question('Please give the username:');

Command/CreateUserCommand.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ protected function configure()
4545
$this
4646
->setName('fos:user:create')
4747
->setDescription('Create a user.')
48-
->setDefinition(array(
48+
->setDefinition([
4949
new InputArgument('username', InputArgument::REQUIRED, 'The username'),
5050
new InputArgument('email', InputArgument::REQUIRED, 'The email'),
5151
new InputArgument('password', InputArgument::REQUIRED, 'The password'),
5252
new InputOption('super-admin', null, InputOption::VALUE_NONE, 'Set the user as super admin'),
5353
new InputOption('inactive', null, InputOption::VALUE_NONE, 'Set the user as inactive'),
54-
))
54+
])
5555
->setHelp(<<<'EOT'
5656
The <info>fos:user:create</info> command creates a user:
5757
@@ -89,14 +89,16 @@ protected function execute(InputInterface $input, OutputInterface $output)
8989
$this->userManipulator->create($username, $password, $email, !$inactive, $superadmin);
9090

9191
$output->writeln(sprintf('Created user <comment>%s</comment>', $username));
92+
93+
return 0;
9294
}
9395

9496
/**
9597
* {@inheritdoc}
9698
*/
9799
protected function interact(InputInterface $input, OutputInterface $output)
98100
{
99-
$questions = array();
101+
$questions = [];
100102

101103
if (!$input->getArgument('username')) {
102104
$question = new Question('Please choose a username:');

Command/DeactivateUserCommand.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ protected function configure()
4242
$this
4343
->setName('fos:user:deactivate')
4444
->setDescription('Deactivate a user')
45-
->setDefinition(array(
45+
->setDefinition([
4646
new InputArgument('username', InputArgument::REQUIRED, 'The username'),
47-
))
47+
])
4848
->setHelp(<<<'EOT'
4949
The <info>fos:user:deactivate</info> command deactivates a user (will not be able to log in)
5050
@@ -63,6 +63,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
6363
$this->userManipulator->deactivate($username);
6464

6565
$output->writeln(sprintf('User "%s" has been deactivated.', $username));
66+
67+
return 0;
6668
}
6769

6870
/**

Command/RoleCommand.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ public function __construct(UserManipulator $userManipulator)
3939
protected function configure()
4040
{
4141
$this
42-
->setDefinition(array(
42+
->setDefinition([
4343
new InputArgument('username', InputArgument::REQUIRED, 'The username'),
4444
new InputArgument('role', InputArgument::OPTIONAL, 'The role'),
4545
new InputOption('super', null, InputOption::VALUE_NONE, 'Instead specifying role, use this to quickly add the super administrator role'),
46-
));
46+
]);
4747
}
4848

4949
/**
@@ -65,16 +65,16 @@ protected function execute(InputInterface $input, OutputInterface $output)
6565

6666
$manipulator = $this->userManipulator;
6767
$this->executeRoleCommand($manipulator, $output, $username, $super, $role);
68+
69+
return 0;
6870
}
6971

7072
/**
7173
* @see Command
7274
*
73-
* @param UserManipulator $manipulator
74-
* @param OutputInterface $output
75-
* @param string $username
76-
* @param bool $super
77-
* @param string $role
75+
* @param string $username
76+
* @param bool $super
77+
* @param string $role
7878
*/
7979
abstract protected function executeRoleCommand(UserManipulator $manipulator, OutputInterface $output, $username, $super, $role);
8080

@@ -83,7 +83,7 @@ abstract protected function executeRoleCommand(UserManipulator $manipulator, Out
8383
*/
8484
protected function interact(InputInterface $input, OutputInterface $output)
8585
{
86-
$questions = array();
86+
$questions = [];
8787

8888
if (!$input->getArgument('username')) {
8989
$question = new Question('Please choose a username:');

Controller/ChangePasswordController.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
*
3131
* @author Thibault Duplessis <thibault.duplessis@gmail.com>
3232
* @author Christophe Coevoet <stof@notk.org>
33+
*
34+
* @final
3335
*/
3436
class ChangePasswordController extends Controller
3537
{
@@ -47,8 +49,6 @@ public function __construct(EventDispatcherInterface $eventDispatcher, FactoryIn
4749
/**
4850
* Change user password.
4951
*
50-
* @param Request $request
51-
*
5252
* @return Response
5353
*/
5454
public function changePasswordAction(Request $request)
@@ -86,8 +86,8 @@ public function changePasswordAction(Request $request)
8686
return $response;
8787
}
8888

89-
return $this->render('@FOSUser/ChangePassword/change_password.html.twig', array(
89+
return $this->render('@FOSUser/ChangePassword/change_password.html.twig', [
9090
'form' => $form->createView(),
91-
));
91+
]);
9292
}
9393
}

Controller/GroupController.php

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
*
3232
* @author Thibault Duplessis <thibault.duplessis@gmail.com>
3333
* @author Christophe Coevoet <stof@notk.org>
34+
*
35+
* @final
3436
*/
3537
class GroupController extends Controller
3638
{
@@ -50,9 +52,9 @@ public function __construct(EventDispatcherInterface $eventDispatcher, FactoryIn
5052
*/
5153
public function listAction()
5254
{
53-
return $this->render('@FOSUser/Group/list.html.twig', array(
55+
return $this->render('@FOSUser/Group/list.html.twig', [
5456
'groups' => $this->groupManager->findGroups(),
55-
));
57+
]);
5658
}
5759

5860
/**
@@ -64,16 +66,15 @@ public function listAction()
6466
*/
6567
public function showAction($groupName)
6668
{
67-
return $this->render('@FOSUser/Group/show.html.twig', array(
69+
return $this->render('@FOSUser/Group/show.html.twig', [
6870
'group' => $this->findGroupBy('name', $groupName),
69-
));
71+
]);
7072
}
7173

7274
/**
7375
* Edit one group, show the edit form.
7476
*
75-
* @param Request $request
76-
* @param string $groupName
77+
* @param string $groupName
7778
*
7879
* @return Response
7980
*/
@@ -100,7 +101,7 @@ public function editAction(Request $request, $groupName)
100101
$this->groupManager->updateGroup($group);
101102

102103
if (null === $response = $event->getResponse()) {
103-
$url = $this->generateUrl('fos_user_group_show', array('groupName' => $group->getName()));
104+
$url = $this->generateUrl('fos_user_group_show', ['groupName' => $group->getName()]);
104105
$response = new RedirectResponse($url);
105106
}
106107

@@ -109,17 +110,15 @@ public function editAction(Request $request, $groupName)
109110
return $response;
110111
}
111112

112-
return $this->render('@FOSUser/Group/edit.html.twig', array(
113+
return $this->render('@FOSUser/Group/edit.html.twig', [
113114
'form' => $form->createView(),
114115
'group_name' => $group->getName(),
115-
));
116+
]);
116117
}
117118

118119
/**
119120
* Show the new form.
120121
*
121-
* @param Request $request
122-
*
123122
* @return Response
124123
*/
125124
public function newAction(Request $request)
@@ -140,7 +139,7 @@ public function newAction(Request $request)
140139
$this->groupManager->updateGroup($group);
141140

142141
if (null === $response = $event->getResponse()) {
143-
$url = $this->generateUrl('fos_user_group_show', array('groupName' => $group->getName()));
142+
$url = $this->generateUrl('fos_user_group_show', ['groupName' => $group->getName()]);
144143
$response = new RedirectResponse($url);
145144
}
146145

@@ -149,16 +148,15 @@ public function newAction(Request $request)
149148
return $response;
150149
}
151150

152-
return $this->render('@FOSUser/Group/new.html.twig', array(
151+
return $this->render('@FOSUser/Group/new.html.twig', [
153152
'form' => $form->createView(),
154-
));
153+
]);
155154
}
156155

157156
/**
158157
* Delete one group.
159158
*
160-
* @param Request $request
161-
* @param string $groupName
159+
* @param string $groupName
162160
*
163161
* @return RedirectResponse
164162
*/

Controller/ProfileController.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
* Controller managing the user profile.
3030
*
3131
* @author Christophe Coevoet <stof@notk.org>
32+
*
33+
* @final
3234
*/
3335
class ProfileController extends Controller
3436
{
@@ -53,16 +55,14 @@ public function showAction()
5355
throw new AccessDeniedException('This user does not have access to this section.');
5456
}
5557

56-
return $this->render('@FOSUser/Profile/show.html.twig', array(
58+
return $this->render('@FOSUser/Profile/show.html.twig', [
5759
'user' => $user,
58-
));
60+
]);
5961
}
6062

6163
/**
6264
* Edit the user.
6365
*
64-
* @param Request $request
65-
*
6666
* @return Response
6767
*/
6868
public function editAction(Request $request)
@@ -100,8 +100,8 @@ public function editAction(Request $request)
100100
return $response;
101101
}
102102

103-
return $this->render('@FOSUser/Profile/edit.html.twig', array(
103+
return $this->render('@FOSUser/Profile/edit.html.twig', [
104104
'form' => $form->createView(),
105-
));
105+
]);
106106
}
107107
}

0 commit comments

Comments
 (0)