Skip to content

Commit 8630dc1

Browse files
committed
style: fix codebase with CS Fixer
1 parent 3a4c378 commit 8630dc1

File tree

104 files changed

+513
-299
lines changed

Some content is hidden

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

104 files changed

+513
-299
lines changed

Command/CleanCommand.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
/*
46
* This file is part of the FOSOAuthServerBundle package.
57
*
@@ -11,11 +13,11 @@
1113

1214
namespace FOS\OAuthServerBundle\Command;
1315

16+
use FOS\OAuthServerBundle\Model\AuthCodeManagerInterface;
17+
use FOS\OAuthServerBundle\Model\TokenManagerInterface;
1418
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
1519
use Symfony\Component\Console\Input\InputInterface;
1620
use Symfony\Component\Console\Output\OutputInterface;
17-
use FOS\OAuthServerBundle\Model\TokenManagerInterface;
18-
use FOS\OAuthServerBundle\Model\AuthCodeManagerInterface;
1921

2022
class CleanCommand extends ContainerAwareCommand
2123
{
@@ -40,11 +42,11 @@ protected function configure()
4042
*/
4143
protected function execute(InputInterface $input, OutputInterface $output)
4244
{
43-
$services = array(
44-
'fos_oauth_server.access_token_manager' => 'Access token',
45+
$services = [
46+
'fos_oauth_server.access_token_manager' => 'Access token',
4547
'fos_oauth_server.refresh_token_manager' => 'Refresh token',
46-
'fos_oauth_server.auth_code_manager' => 'Auth code',
47-
);
48+
'fos_oauth_server.auth_code_manager' => 'Auth code',
49+
];
4850

4951
foreach ($services as $service => $name) {
5052
/** @var $instance TokenManagerInterface */

Controller/AuthorizeController.php

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
/*
46
* This file is part of the FOSOAuthServerBundle package.
57
*
@@ -17,9 +19,9 @@
1719
use FOS\OAuthServerBundle\Model\ClientManagerInterface;
1820
use OAuth2\OAuth2;
1921
use OAuth2\OAuth2ServerException;
22+
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
2023
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
2124
use Symfony\Component\DependencyInjection\ContainerInterface;
22-
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
2325
use Symfony\Component\EventDispatcher\EventDispatcher;
2426
use Symfony\Component\Form\Form;
2527
use Symfony\Component\HttpFoundation\Request;
@@ -39,15 +41,14 @@
3941
*/
4042
class AuthorizeController implements ContainerAwareInterface
4143
{
42-
/**
43-
* @var ClientInterface
44-
*/
45-
private $client;
46-
4744
/**
4845
* @var ContainerInterface
4946
*/
5047
protected $container;
48+
/**
49+
* @var ClientInterface
50+
*/
51+
private $client;
5152

5253
/**
5354
* @var SessionInterface
@@ -104,19 +105,10 @@ class AuthorizeController implements ContainerAwareInterface
104105
*/
105106
private $eventDispatcher;
106107

107-
/**
108-
* Sets the container.
109-
*
110-
* @param ContainerInterface|null $container A ContainerInterface instance or null
111-
*/
112-
public function setContainer(ContainerInterface $container = null)
113-
{
114-
$this->container = $container;
115-
}
116-
117108
/**
118109
* This controller had been made as a service due to support symfony 4 where all* services are private by default.
119110
* Thus, there is considered a bad practice to fetch services directly from container.
111+
*
120112
* @todo This controller could be refactored to do not rely on so many dependencies
121113
*
122114
* @param RequestStack $requestStack
@@ -157,6 +149,16 @@ public function __construct(
157149
$this->eventDispatcher = $eventDispatcher;
158150
}
159151

152+
/**
153+
* Sets the container.
154+
*
155+
* @param ContainerInterface|null $container A ContainerInterface instance or null
156+
*/
157+
public function setContainer(ContainerInterface $container = null)
158+
{
159+
$this->container = $container;
160+
}
161+
160162
/**
161163
* Authorize.
162164
*/
@@ -193,10 +195,10 @@ public function authorizeAction(Request $request)
193195

194196
return $this->templating->renderResponse(
195197
'FOSOAuthServerBundle:Authorize:authorize.html.'.$this->templateEngineType,
196-
array(
197-
'form' => $form->createView(),
198+
[
199+
'form' => $form->createView(),
198200
'client' => $this->getClient(),
199-
)
201+
]
200202
);
201203
}
202204

@@ -256,7 +258,7 @@ protected function getClient()
256258
if (null !== $request) {
257259
if (null === $clientId = $request->get('client_id')) {
258260
$form = $this->authorizeForm;
259-
$formData = $request->get($form->getName(), array());
261+
$formData = $request->get($form->getName(), []);
260262
$clientId = isset($formData['client_id']) ? $formData['client_id'] : null;
261263
}
262264

Controller/TokenController.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
/*
46
* This file is part of the FOSOAuthServerBundle package.
57
*
@@ -11,9 +13,9 @@
1113

1214
namespace FOS\OAuthServerBundle\Controller;
1315

14-
use Symfony\Component\HttpFoundation\Request;
1516
use OAuth2\OAuth2;
1617
use OAuth2\OAuth2ServerException;
18+
use Symfony\Component\HttpFoundation\Request;
1719
use Symfony\Component\HttpFoundation\Response;
1820

1921
class TokenController

DependencyInjection/Compiler/GrantExtensionsCompilerPass.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
/*
46
* This file is part of the FOSOAuthServerBundle package.
57
*
@@ -13,8 +15,8 @@
1315

1416
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
1517
use Symfony\Component\DependencyInjection\ContainerBuilder;
16-
use Symfony\Component\DependencyInjection\Reference;
1718
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
19+
use Symfony\Component\DependencyInjection\Reference;
1820

1921
/**
2022
* @author Adrien Brault <[email protected]>
@@ -36,7 +38,7 @@ public function process(ContainerBuilder $container)
3638
throw new InvalidArgumentException(sprintf('Service "%s" must define the "uri" attribute on "fos_oauth_server.grant_extension" tags.', $id));
3739
}
3840

39-
$storageDefinition->addMethodCall('setGrantExtension', array($tag['uri'], new Reference($id)));
41+
$storageDefinition->addMethodCall('setGrantExtension', [$tag['uri'], new Reference($id)]);
4042
}
4143
}
4244
}

DependencyInjection/Compiler/RequestStackCompilerPass.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
/*
46
* This file is part of the FOSOAuthServerBundle package.
57
*
@@ -32,6 +34,6 @@ public function process(ContainerBuilder $container)
3234
}
3335

3436
$definition = $container->getDefinition('fos_oauth_server.authorize.form.handler.default');
35-
$definition->addMethodCall('setContainer', array(new Reference('service_container')));
37+
$definition->addMethodCall('setContainer', [new Reference('service_container')]);
3638
}
3739
}

DependencyInjection/Compiler/TokenStorageCompilerPass.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
/*
46
* This file is part of the FOSOAuthServerBundle package.
57
*

DependencyInjection/Configuration.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
/*
46
* This file is part of the FOSOAuthServerBundle package.
57
*
@@ -30,7 +32,7 @@ public function getConfigTreeBuilder()
3032
$treeBuilder = new TreeBuilder();
3133
$rootNode = $treeBuilder->root('fos_oauth_server');
3234

33-
$supportedDrivers = array('orm', 'mongodb', 'propel');
35+
$supportedDrivers = ['orm', 'mongodb', 'propel'];
3436

3537
$rootNode
3638
->children()
@@ -72,7 +74,7 @@ private function addAuthorizeSection(ArrayNodeDefinition $node)
7274
->scalarNode('name')->defaultValue('fos_oauth_server_authorize_form')->cannotBeEmpty()->end()
7375
->arrayNode('validation_groups')
7476
->prototype('scalar')->end()
75-
->defaultValue(array('Authorize', 'Default'))
77+
->defaultValue(['Authorize', 'Default'])
7678
->end()
7779
->end()
7880
->end()
@@ -97,7 +99,7 @@ private function addServiceSection(ArrayNodeDefinition $node)
9799
->scalarNode('auth_code_manager')->defaultValue('fos_oauth_server.auth_code_manager.default')->end()
98100
->arrayNode('options')
99101
->useAttributeAsKey('key')
100-
->treatNullLike(array())
102+
->treatNullLike([])
101103
->prototype('scalar')->end()
102104
->end()
103105
->end()

DependencyInjection/FOSOAuthServerExtension.php

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
/*
46
* This file is part of the FOSOAuthServerBundle package.
57
*
@@ -11,14 +13,14 @@
1113

1214
namespace FOS\OAuthServerBundle\DependencyInjection;
1315

16+
use FOS\OAuthServerBundle\Util\LegacyFormHelper;
1417
use Symfony\Component\Config\Definition\Processor;
18+
use Symfony\Component\Config\FileLocator;
19+
use Symfony\Component\DependencyInjection\Alias;
20+
use Symfony\Component\DependencyInjection\ContainerBuilder;
21+
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
1522
use Symfony\Component\DependencyInjection\Reference;
1623
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
17-
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
18-
use Symfony\Component\DependencyInjection\ContainerBuilder;
19-
use Symfony\Component\DependencyInjection\Alias;
20-
use Symfony\Component\Config\FileLocator;
21-
use FOS\OAuthServerBundle\Util\LegacyFormHelper;
2224

2325
class FOSOAuthServerExtension extends Extension
2426
{
@@ -35,7 +37,7 @@ public function load(array $configs, ContainerBuilder $container)
3537
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
3638
$loader->load(sprintf('%s.xml', $config['db_driver']));
3739

38-
foreach (array('oauth', 'security') as $basename) {
40+
foreach (['oauth', 'security'] as $basename) {
3941
$loader->load(sprintf('%s.xml', $basename));
4042
}
4143

@@ -51,16 +53,16 @@ public function load(array $configs, ContainerBuilder $container)
5153

5254
$container->setParameter('fos_oauth_server.server.options', $config['service']['options']);
5355

54-
$this->remapParametersNamespaces($config, $container, array(
55-
'' => array(
56-
'model_manager_name' => 'fos_oauth_server.model_manager_name',
57-
'client_class' => 'fos_oauth_server.model.client.class',
58-
'access_token_class' => 'fos_oauth_server.model.access_token.class',
56+
$this->remapParametersNamespaces($config, $container, [
57+
'' => [
58+
'model_manager_name' => 'fos_oauth_server.model_manager_name',
59+
'client_class' => 'fos_oauth_server.model.client.class',
60+
'access_token_class' => 'fos_oauth_server.model.access_token.class',
5961
'refresh_token_class' => 'fos_oauth_server.model.refresh_token.class',
60-
'auth_code_class' => 'fos_oauth_server.model.auth_code.class',
61-
),
62+
'auth_code_class' => 'fos_oauth_server.model.auth_code.class',
63+
],
6264
'template' => 'fos_oauth_server.template.%s',
63-
));
65+
]);
6466

6567
// Handle the MongoDB document manager name in a specific way as it does not have a registry to make it easy
6668
// TODO: change it when bumping the requirement to Symfony 2.1
@@ -81,7 +83,7 @@ public function load(array $configs, ContainerBuilder $container)
8183
if ('orm' === $config['db_driver']) {
8284
$ormEntityManagerDefinition = $container->getDefinition('fos_oauth_server.entity_manager');
8385
if (method_exists($ormEntityManagerDefinition, 'setFactory')) {
84-
$ormEntityManagerDefinition->setFactory(array(new Reference('doctrine'), 'getManager'));
86+
$ormEntityManagerDefinition->setFactory([new Reference('doctrine'), 'getManager']);
8587
} else {
8688
$ormEntityManagerDefinition->setFactoryService('doctrine');
8789
$ormEntityManagerDefinition->setFactoryMethod('getManager');
@@ -96,7 +98,7 @@ public function load(array $configs, ContainerBuilder $container)
9698
// TODO: Go back to xml configuration when bumping the requirement to Symfony >=2.6
9799
$authorizeFormDefinition = $container->getDefinition('fos_oauth_server.authorize.form');
98100
if (method_exists($authorizeFormDefinition, 'setFactory')) {
99-
$authorizeFormDefinition->setFactory(array(new Reference('form.factory'), 'createNamed'));
101+
$authorizeFormDefinition->setFactory([new Reference('form.factory'), 'createNamed']);
100102
} else {
101103
$authorizeFormDefinition->setFactoryService('form.factory');
102104
$authorizeFormDefinition->setFactoryMethod('createNamed');
@@ -154,8 +156,8 @@ protected function loadAuthorize(array $config, ContainerBuilder $container, Xml
154156
$config['form']['type'] = $authorizeFormTypeDefinition->getClass();
155157
}
156158

157-
$this->remapParametersNamespaces($config, $container, array(
159+
$this->remapParametersNamespaces($config, $container, [
158160
'form' => 'fos_oauth_server.authorize.form.%s',
159-
));
161+
]);
160162
}
161163
}

DependencyInjection/Security/Factory/OAuthFactory.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
/*
46
* This file is part of the FOSOAuthServerBundle package.
57
*
@@ -38,8 +40,7 @@ public function create(ContainerBuilder $container, $id, $config, $userProvider,
3840
}
3941
$container
4042
->setDefinition($providerId, $definition)
41-
->replaceArgument(0, new Reference($userProvider))
42-
;
43+
->replaceArgument(0, new Reference($userProvider));
4344

4445
$listenerId = 'security.authentication.listener.fos_oauth_server.'.$id;
4546

@@ -50,7 +51,7 @@ public function create(ContainerBuilder $container, $id, $config, $userProvider,
5051
}
5152
$container->setDefinition($listenerId, $definition);
5253

53-
return array($providerId, $listenerId, 'fos_oauth_server.security.entry_point');
54+
return [$providerId, $listenerId, 'fos_oauth_server.security.entry_point'];
5455
}
5556

5657
/**

Document/AccessToken.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
/*
46
* This file is part of the FOSOAuthServerBundle package.
57
*

0 commit comments

Comments
 (0)