Skip to content

Commit 3e41c84

Browse files
authored
Merge pull request #2958 from XWB/short-array-syntax
Switch to short array syntax and run CS fixer
2 parents a274673 + 6f32e85 commit 3e41c84

File tree

83 files changed

+414
-681
lines changed

Some content is hidden

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

83 files changed

+414
-681
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,

Command/ActivateUserCommand.php

Lines changed: 2 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

Command/ChangePasswordCommand.php

Lines changed: 3 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
@@ -78,7 +78,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
7878
*/
7979
protected function interact(InputInterface $input, OutputInterface $output)
8080
{
81-
$questions = array();
81+
$questions = [];
8282

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

Command/CreateUserCommand.php

Lines changed: 3 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
@@ -98,7 +98,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
9898
*/
9999
protected function interact(InputInterface $input, OutputInterface $output)
100100
{
101-
$questions = array();
101+
$questions = [];
102102

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

Command/DeactivateUserCommand.php

Lines changed: 2 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

Command/RoleCommand.php

Lines changed: 6 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
/**
@@ -72,11 +72,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
7272
/**
7373
* @see Command
7474
*
75-
* @param UserManipulator $manipulator
76-
* @param OutputInterface $output
77-
* @param string $username
78-
* @param bool $super
79-
* @param string $role
75+
* @param string $username
76+
* @param bool $super
77+
* @param string $role
8078
*/
8179
abstract protected function executeRoleCommand(UserManipulator $manipulator, OutputInterface $output, $username, $super, $role);
8280

@@ -85,7 +83,7 @@ abstract protected function executeRoleCommand(UserManipulator $manipulator, Out
8583
*/
8684
protected function interact(InputInterface $input, OutputInterface $output)
8785
{
88-
$questions = array();
86+
$questions = [];
8987

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

Controller/ChangePasswordController.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ public function __construct(EventDispatcherInterface $eventDispatcher, FactoryIn
4949
/**
5050
* Change user password.
5151
*
52-
* @param Request $request
53-
*
5452
* @return Response
5553
*/
5654
public function changePasswordAction(Request $request)
@@ -88,8 +86,8 @@ public function changePasswordAction(Request $request)
8886
return $response;
8987
}
9088

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

Controller/GroupController.php

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ public function __construct(EventDispatcherInterface $eventDispatcher, FactoryIn
5252
*/
5353
public function listAction()
5454
{
55-
return $this->render('@FOSUser/Group/list.html.twig', array(
55+
return $this->render('@FOSUser/Group/list.html.twig', [
5656
'groups' => $this->groupManager->findGroups(),
57-
));
57+
]);
5858
}
5959

6060
/**
@@ -66,16 +66,15 @@ public function listAction()
6666
*/
6767
public function showAction($groupName)
6868
{
69-
return $this->render('@FOSUser/Group/show.html.twig', array(
69+
return $this->render('@FOSUser/Group/show.html.twig', [
7070
'group' => $this->findGroupBy('name', $groupName),
71-
));
71+
]);
7272
}
7373

7474
/**
7575
* Edit one group, show the edit form.
7676
*
77-
* @param Request $request
78-
* @param string $groupName
77+
* @param string $groupName
7978
*
8079
* @return Response
8180
*/
@@ -102,7 +101,7 @@ public function editAction(Request $request, $groupName)
102101
$this->groupManager->updateGroup($group);
103102

104103
if (null === $response = $event->getResponse()) {
105-
$url = $this->generateUrl('fos_user_group_show', array('groupName' => $group->getName()));
104+
$url = $this->generateUrl('fos_user_group_show', ['groupName' => $group->getName()]);
106105
$response = new RedirectResponse($url);
107106
}
108107

@@ -111,17 +110,15 @@ public function editAction(Request $request, $groupName)
111110
return $response;
112111
}
113112

114-
return $this->render('@FOSUser/Group/edit.html.twig', array(
113+
return $this->render('@FOSUser/Group/edit.html.twig', [
115114
'form' => $form->createView(),
116115
'group_name' => $group->getName(),
117-
));
116+
]);
118117
}
119118

120119
/**
121120
* Show the new form.
122121
*
123-
* @param Request $request
124-
*
125122
* @return Response
126123
*/
127124
public function newAction(Request $request)
@@ -142,7 +139,7 @@ public function newAction(Request $request)
142139
$this->groupManager->updateGroup($group);
143140

144141
if (null === $response = $event->getResponse()) {
145-
$url = $this->generateUrl('fos_user_group_show', array('groupName' => $group->getName()));
142+
$url = $this->generateUrl('fos_user_group_show', ['groupName' => $group->getName()]);
146143
$response = new RedirectResponse($url);
147144
}
148145

@@ -151,16 +148,15 @@ public function newAction(Request $request)
151148
return $response;
152149
}
153150

154-
return $this->render('@FOSUser/Group/new.html.twig', array(
151+
return $this->render('@FOSUser/Group/new.html.twig', [
155152
'form' => $form->createView(),
156-
));
153+
]);
157154
}
158155

159156
/**
160157
* Delete one group.
161158
*
162-
* @param Request $request
163-
* @param string $groupName
159+
* @param string $groupName
164160
*
165161
* @return RedirectResponse
166162
*/

Controller/ProfileController.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,14 @@ public function showAction()
5555
throw new AccessDeniedException('This user does not have access to this section.');
5656
}
5757

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

6363
/**
6464
* Edit the user.
6565
*
66-
* @param Request $request
67-
*
6866
* @return Response
6967
*/
7068
public function editAction(Request $request)
@@ -102,8 +100,8 @@ public function editAction(Request $request)
102100
return $response;
103101
}
104102

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

Controller/RegistrationController.php

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ public function __construct(EventDispatcherInterface $eventDispatcher, FactoryIn
5151
}
5252

5353
/**
54-
* @param Request $request
55-
*
5654
* @return Response
5755
*/
5856
public function registerAction(Request $request)
@@ -97,9 +95,9 @@ public function registerAction(Request $request)
9795
}
9896
}
9997

100-
return $this->render('@FOSUser/Registration/register.html.twig', array(
98+
return $this->render('@FOSUser/Registration/register.html.twig', [
10199
'form' => $form->createView(),
102-
));
100+
]);
103101
}
104102

105103
/**
@@ -120,16 +118,15 @@ public function checkEmailAction(Request $request)
120118
return new RedirectResponse($this->container->get('router')->generate('fos_user_security_login'));
121119
}
122120

123-
return $this->render('@FOSUser/Registration/check_email.html.twig', array(
121+
return $this->render('@FOSUser/Registration/check_email.html.twig', [
124122
'user' => $user,
125-
));
123+
]);
126124
}
127125

128126
/**
129127
* Receive the confirmation token from user email provider, login the user.
130128
*
131-
* @param Request $request
132-
* @param string $token
129+
* @param string $token
133130
*
134131
* @return Response
135132
*/
@@ -171,10 +168,10 @@ public function confirmedAction(Request $request)
171168
throw new AccessDeniedException('This user does not have access to this section.');
172169
}
173170

174-
return $this->render('@FOSUser/Registration/confirmed.html.twig', array(
171+
return $this->render('@FOSUser/Registration/confirmed.html.twig', [
175172
'user' => $user,
176173
'targetUrl' => $this->getTargetUrlFromSession($request->getSession()),
177-
));
174+
]);
178175
}
179176

180177
/**

0 commit comments

Comments
 (0)