Skip to content

Commit 23eb739

Browse files
authored
Merge pull request #2668 from XWB/csfixer
Upgrade CS fixer
2 parents 3d8f8f4 + 0451881 commit 23eb739

23 files changed

Lines changed: 192 additions & 187 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.php_cs
12
.php_cs.cache
23
composer.lock
34
phpunit.xml

.php_cs

Lines changed: 0 additions & 35 deletions
This file was deleted.

.php_cs.dist

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
$header = <<<EOF
4+
This file is part of the FOSUserBundle package.
5+
6+
(c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
7+
8+
For the full copyright and license information, please view the LICENSE
9+
file that was distributed with this source code.
10+
EOF;
11+
12+
return PhpCsFixer\Config::create()
13+
->setRules([
14+
'@Symfony' => true,
15+
'array_syntax' => ['syntax' => 'long'],
16+
'combine_consecutive_unsets' => true,
17+
'header_comment' => ['header' => $header],
18+
'linebreak_after_opening_tag' => true,
19+
'no_php4_constructor' => true,
20+
'no_useless_else' => true,
21+
'ordered_class_elements' => true,
22+
'ordered_imports' => true,
23+
'php_unit_construct' => true,
24+
'php_unit_strict' => true,
25+
'phpdoc_no_empty_return' => false,
26+
])
27+
->setUsingCache(true)
28+
->setRiskyAllowed(true)
29+
->setFinder(
30+
PhpCsFixer\Finder::create()
31+
->in(__DIR__)
32+
)
33+
;

Controller/ProfileController.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
use Symfony\Component\HttpFoundation\Request;
2828
use Symfony\Component\HttpFoundation\Response;
2929
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
30-
use Symfony\Component\Translation\Translator;
3130
use Symfony\Component\Translation\TranslatorInterface;
3231

3332
/**

Controller/SecurityController.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,16 @@ public function loginAction(Request $request)
8181
));
8282
}
8383

84+
public function checkAction()
85+
{
86+
throw new \RuntimeException('You must configure the check path to be handled by the firewall using form_login in your security firewall configuration.');
87+
}
88+
89+
public function logoutAction()
90+
{
91+
throw new \RuntimeException('You must activate the logout in your security firewall configuration.');
92+
}
93+
8494
/**
8595
* Renders the login template with the given parameters. Overwrite this function in
8696
* an extended controller to provide additional data for the login template.
@@ -93,14 +103,4 @@ protected function renderLogin(array $data)
93103
{
94104
return $this->render('@FOSUser/Security/login.html.twig', $data);
95105
}
96-
97-
public function checkAction()
98-
{
99-
throw new \RuntimeException('You must configure the check path to be handled by the firewall using form_login in your security firewall configuration.');
100-
}
101-
102-
public function logoutAction()
103-
{
104-
throw new \RuntimeException('You must activate the logout in your security firewall configuration.');
105-
}
106106
}

DependencyInjection/FOSUserExtension.php

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,54 @@ public function load(array $configs, ContainerBuilder $container)
133133
}
134134
}
135135

136+
/**
137+
* {@inheritdoc}
138+
*/
139+
public function getNamespace()
140+
{
141+
return 'http://friendsofsymfony.github.io/schema/dic/user';
142+
}
143+
144+
/**
145+
* @param array $config
146+
* @param ContainerBuilder $container
147+
* @param array $map
148+
*/
149+
protected function remapParameters(array $config, ContainerBuilder $container, array $map)
150+
{
151+
foreach ($map as $name => $paramName) {
152+
if (array_key_exists($name, $config)) {
153+
$container->setParameter($paramName, $config[$name]);
154+
}
155+
}
156+
}
157+
158+
/**
159+
* @param array $config
160+
* @param ContainerBuilder $container
161+
* @param array $namespaces
162+
*/
163+
protected function remapParametersNamespaces(array $config, ContainerBuilder $container, array $namespaces)
164+
{
165+
foreach ($namespaces as $ns => $map) {
166+
if ($ns) {
167+
if (!array_key_exists($ns, $config)) {
168+
continue;
169+
}
170+
$namespaceConfig = $config[$ns];
171+
} else {
172+
$namespaceConfig = $config;
173+
}
174+
if (is_array($map)) {
175+
$this->remapParameters($namespaceConfig, $container, $map);
176+
} else {
177+
foreach ($namespaceConfig as $name => $value) {
178+
$container->setParameter(sprintf($map, $name), $value);
179+
}
180+
}
181+
}
182+
}
183+
136184
/**
137185
* @param array $config
138186
* @param ContainerBuilder $container
@@ -254,52 +302,4 @@ private function loadGroups(array $config, ContainerBuilder $container, XmlFileL
254302
'form' => 'fos_user.group.form.%s',
255303
));
256304
}
257-
258-
/**
259-
* @param array $config
260-
* @param ContainerBuilder $container
261-
* @param array $map
262-
*/
263-
protected function remapParameters(array $config, ContainerBuilder $container, array $map)
264-
{
265-
foreach ($map as $name => $paramName) {
266-
if (array_key_exists($name, $config)) {
267-
$container->setParameter($paramName, $config[$name]);
268-
}
269-
}
270-
}
271-
272-
/**
273-
* @param array $config
274-
* @param ContainerBuilder $container
275-
* @param array $namespaces
276-
*/
277-
protected function remapParametersNamespaces(array $config, ContainerBuilder $container, array $namespaces)
278-
{
279-
foreach ($namespaces as $ns => $map) {
280-
if ($ns) {
281-
if (!array_key_exists($ns, $config)) {
282-
continue;
283-
}
284-
$namespaceConfig = $config[$ns];
285-
} else {
286-
$namespaceConfig = $config;
287-
}
288-
if (is_array($map)) {
289-
$this->remapParameters($namespaceConfig, $container, $map);
290-
} else {
291-
foreach ($namespaceConfig as $name => $value) {
292-
$container->setParameter(sprintf($map, $name), $value);
293-
}
294-
}
295-
}
296-
}
297-
298-
/**
299-
* {@inheritdoc}
300-
*/
301-
public function getNamespace()
302-
{
303-
return 'http://friendsofsymfony.github.io/schema/dic/user';
304-
}
305305
}

Doctrine/UserManager.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,6 @@ public function __construct(PasswordUpdaterInterface $passwordUpdater, Canonical
4646
$this->class = $class;
4747
}
4848

49-
/**
50-
* @return ObjectRepository
51-
*/
52-
protected function getRepository()
53-
{
54-
return $this->objectManager->getRepository($this->getClass());
55-
}
56-
5749
/**
5850
* {@inheritdoc}
5951
*/
@@ -113,4 +105,12 @@ public function updateUser(UserInterface $user, $andFlush = true)
113105
$this->objectManager->flush();
114106
}
115107
}
108+
109+
/**
110+
* @return ObjectRepository
111+
*/
112+
protected function getRepository()
113+
{
114+
return $this->objectManager->getRepository($this->getClass());
115+
}
116116
}

Form/Type/ChangePasswordFormType.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ public function configureOptions(OptionsResolver $resolver)
8686
}
8787

8888
// BC for SF < 3.0
89+
8990
/**
9091
* {@inheritdoc}
9192
*/

Form/Type/GroupFormType.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public function configureOptions(OptionsResolver $resolver)
5050
}
5151

5252
// BC for SF < 3.0
53+
5354
/**
5455
* {@inheritdoc}
5556
*/

Form/Type/ProfileFormType.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ public function configureOptions(OptionsResolver $resolver)
7575
}
7676

7777
// BC for SF < 3.0
78+
7879
/**
7980
* {@inheritdoc}
8081
*/

0 commit comments

Comments
 (0)