Skip to content

Commit 77e944b

Browse files
committed
Fix coding standard
1 parent 9426874 commit 77e944b

28 files changed

+92
-84
lines changed

.gitignore

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# IDE
2-
/.idea/
1+
vendor/
2+
composer.lock
3+
.php_cs.cache
34

4-
# Composer
5-
/vendor/
6-
/composer.lock

.php_cs.dist

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
return PhpCsFixer\Config::create()
4+
->setRules([
5+
'@Symfony' => true,
6+
'@Symfony:risky' => true,
7+
'@PHPUnit48Migration:risky' => true,
8+
'array_syntax' => ['syntax' => 'short'],
9+
'fopen_flags' => false,
10+
'ordered_imports' => true,
11+
'protected_to_private' => false,
12+
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
13+
])
14+
->setRiskyAllowed(true)
15+
->setFinder(
16+
PhpCsFixer\Finder::create()
17+
->in([__DIR__])
18+
->exclude([])
19+
)
20+
;

Controller/PassthruController.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
class PassthruController extends Controller
1515
{
16-
1716
/**
1817
* @Legacy\Dispatch
1918
* @Legacy\Passthru

DependencyInjection/Compiler/CollectFilterPass.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,18 @@
1414

1515
class CollectFilterPass implements CompilerPassInterface
1616
{
17-
1817
public function process(ContainerBuilder $container)
1918
{
2019
$kernelEventListenerDefinition = $container->getDefinition('webfactory_legacy_integration.kernel_event_listener');
2120

2221
foreach ($container->findTaggedServiceIds('webfactory_legacy_integration.filter') as $id => $tags) {
23-
$kernelEventListenerDefinition->addMethodCall('addFilter', array(
24-
new Reference($id)
25-
));
22+
$kernelEventListenerDefinition->addMethodCall('addFilter', [
23+
new Reference($id),
24+
]);
2625
}
27-
26+
2827
if ($container->findTaggedServiceIds('webfactory.integration.filter')) {
29-
throw new \RuntimeException("The webfactory.integration.filter tag has been renamed to webfactory_legacy_integration.filter already back 1.0.23. Please update your DIC configuration, and sorry for the hassle.");
28+
throw new \RuntimeException('The webfactory.integration.filter tag has been renamed to webfactory_legacy_integration.filter already back 1.0.23. Please update your DIC configuration, and sorry for the hassle.');
3029
}
3130
}
3231
}

DependencyInjection/Configuration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function getConfigTreeBuilder()
2222
->scalarNode('parsingMode')
2323
->isRequired()
2424
->validate()
25-
->ifNotInArray(array('html5', 'xhtml10'))
25+
->ifNotInArray(['html5', 'xhtml10'])
2626
->thenInvalid('Invalid parsing mode (choose html5 or xhtm10)')
2727
->end();
2828

DependencyInjection/WebfactoryLegacyIntegrationExtension.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,19 @@
1010

1111
use Symfony\Component\Config\FileLocator;
1212
use Symfony\Component\DependencyInjection\ContainerBuilder;
13-
use Symfony\Component\DependencyInjection\Definition;
1413
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
1514
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
1615

1716
class WebfactoryLegacyIntegrationExtension extends Extension
1817
{
19-
2018
public function load(array $configs, ContainerBuilder $container)
2119
{
2220
$configuration = new Configuration();
2321
$config = $this->processConfiguration($configuration, $configs);
2422

2523
$container->setParameter('webfactory_legacy_integration.legacy_application_bootstrap_file', $config['legacyApplicationBootstrapFile']);
2624

27-
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
25+
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
2826
$loader->load('services.xml');
2927

3028
switch (@$config['parsingMode']) {

EventListener/LegacyApplicationDispatchingEventListener.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,14 @@
1717

1818
class LegacyApplicationDispatchingEventListener
1919
{
20-
2120
protected $container;
2221
protected $reader;
2322
protected $stopwatch;
2423

2524
/**
2625
* @var Filter[]
2726
*/
28-
protected $filters = array();
27+
protected $filters = [];
2928

3029
public function __construct(ContainerInterface $container, Reader $reader)
3130
{
@@ -40,7 +39,7 @@ public function addFilter(Filter $filter)
4039

4140
public function onKernelController(FilterControllerEvent $event)
4241
{
43-
if (!is_array($controller = $event->getController())) {
42+
if (!\is_array($controller = $event->getController())) {
4443
return;
4544
}
4645

@@ -56,7 +55,6 @@ public function onKernelController(FilterControllerEvent $event)
5655
}
5756

5857
if ($dispatch) {
59-
6058
$response = $this->getLegacyApplication()->handle($event->getRequest(), $event->getRequestType(), false);
6159

6260
foreach ($this->filters as $filter) {
@@ -76,4 +74,3 @@ protected function getLegacyApplication()
7674
return $this->container->get('webfactory_legacy_integration.legacy_application');
7775
}
7876
}
79-

Integration/Annotation/Filter.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
*/
1818
class Filter implements Factory
1919
{
20-
2120
protected $class;
2221
protected $service;
2322

@@ -29,24 +28,29 @@ public function __construct($values)
2928
if (isset($values['service'])) {
3029
$this->service = $values['service'];
3130
}
32-
if (!$this->class && !$this->service)
31+
if (!$this->class && !$this->service) {
3332
throw new \Exception('Parameter "class" or "service" is missing in Webfactory\Bundle\LegacyIntegrationBundle\Integration\Annotation\Filter.');
33+
}
3434
}
3535

3636
public function createFilter(Container $container)
3737
{
3838
if ($class = $this->class) {
39-
if (!class_exists($class))
40-
throw new \Exception('Unknown class ' . $class . ' configured with the Webfactory\Bundle\LegacyIntegrationBundle\Integration\Annotation\Filter annotation.');
39+
if (!class_exists($class)) {
40+
throw new \Exception('Unknown class '.$class.' configured with the Webfactory\Bundle\LegacyIntegrationBundle\Integration\Annotation\Filter annotation.');
41+
}
4142
$filter = new $class();
4243
}
4344
if ($service = $this->service) {
44-
if (!$container->has($service))
45-
throw new \Exception('Unknown service ' . $service . ' configured with the Webfactory\Bundle\LegacyIntegrationBundle\Integration\Annotation\Filter annotation.');
45+
if (!$container->has($service)) {
46+
throw new \Exception('Unknown service '.$service.' configured with the Webfactory\Bundle\LegacyIntegrationBundle\Integration\Annotation\Filter annotation.');
47+
}
4648
$filter = $container->get($service);
4749
}
48-
if (!$filter instanceof FilterInterface)
49-
throw new \Exception("Class " . get_class($filter) . ' configured with the Webfactory\Bundle\LegacyIntegrationBundle\Integration\Annotation\Filter annotation is not a Webfactory\Bundle\LegacyIntegrationBundle\Integration\Filter.');
50+
if (!$filter instanceof FilterInterface) {
51+
throw new \Exception('Class '.\get_class($filter).' configured with the Webfactory\Bundle\LegacyIntegrationBundle\Integration\Annotation\Filter annotation is not a Webfactory\Bundle\LegacyIntegrationBundle\Integration\Filter.');
52+
}
53+
5054
return $filter;
5155
}
5256
}

Integration/Annotation/IgnoreHeader.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,12 @@
1717
*/
1818
class IgnoreHeader implements Factory
1919
{
20-
2120
protected $header;
2221

2322
public function __construct(array $values)
2423
{
2524
$this->header = array_shift($values);
26-
if (!is_string($this->header)) {
25+
if (!\is_string($this->header)) {
2726
throw new \Exception("Please define a header with the Webfactory\Bundle\LegacyIntegrationBundle\Integration\Annotation\IgnoreHeader annotation.");
2827
}
2928
}

Integration/Annotation/IgnoreRedirect.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
*/
1818
class IgnoreRedirect implements Factory
1919
{
20-
2120
public function createFilter(Container $container)
2221
{
2322
return new IgnoreRedirectFilter();

0 commit comments

Comments
 (0)