Skip to content

Commit 4e5ed74

Browse files
committed
Merge pull request #182 from symfony-cmf/styleci
Introduced Style CI
2 parents 3e60536 + 0c57ee8 commit 4e5ed74

File tree

48 files changed

+263
-235
lines changed

Some content is hidden

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

48 files changed

+263
-235
lines changed

.styleci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
preset: symfony

Admin/Extension/ChildExtension.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/*
44
* This file is part of the Symfony CMF package.
55
*
6-
* (c) 2011-2014 Symfony CMF
6+
* (c) 2011-2015 Symfony CMF
77
*
88
* For the full copyright and license information, please view the LICENSE
99
* file that was distributed with this source code.
@@ -24,9 +24,9 @@
2424
class ChildExtension extends AdminExtension
2525
{
2626
/**
27-
* Set a default parent if defined in the request
27+
* Set a default parent if defined in the request.
2828
*
29-
* {@inheritDoc}
29+
* {@inheritdoc}
3030
*/
3131
public function alterNewInstance(AdminInterface $admin, $object)
3232
{
@@ -41,7 +41,7 @@ public function alterNewInstance(AdminInterface $admin, $object)
4141
return;
4242
}
4343

44-
switch($object) {
44+
switch ($object) {
4545
case $object instanceof HierarchyInterface:
4646
$object->setParentDocument($parent);
4747
break;

Admin/Extension/PublishTimePeriodExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function __construct($formGroup = 'form.group_publish_workflow')
3636
}
3737

3838
/**
39-
* {@inheritDoc}
39+
* {@inheritdoc}
4040
*/
4141
public function configureFormFields(FormMapper $formMapper)
4242
{

Admin/Extension/PublishableExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function __construct($formGroup = 'form.group_publish_workflow')
3636
}
3737

3838
/**
39-
* {@inheritDoc}
39+
* {@inheritdoc}
4040
*/
4141
public function configureFormFields(FormMapper $formMapper)
4242
{

Admin/Extension/TranslatableExtension.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function __construct($locales, $formGroup = 'form.group_general')
4545
}
4646

4747
/**
48-
* {@inheritDoc}
48+
* {@inheritdoc}
4949
*/
5050
public function configureListFields(ListMapper $listMapper)
5151
{
@@ -58,7 +58,7 @@ public function configureListFields(ListMapper $listMapper)
5858
}
5959

6060
/**
61-
* {@inheritDoc}
61+
* {@inheritdoc}
6262
*/
6363
public function configureFormFields(FormMapper $formMapper)
6464
{
@@ -76,12 +76,12 @@ public function configureFormFields(FormMapper $formMapper)
7676
/**
7777
* Sanity check and default locale to request locale.
7878
*
79-
* {@inheritDoc}
79+
* {@inheritdoc}
8080
*/
8181
public function alterNewInstance(AdminInterface $admin, $object)
8282
{
8383
if (!$object instanceof TranslatableInterface) {
84-
throw new \InvalidArgumentException('Expected TranslatableInterface, got ' . get_class($object));
84+
throw new \InvalidArgumentException('Expected TranslatableInterface, got '.get_class($object));
8585
}
8686

8787
if ($admin->hasRequest()) {

DependencyInjection/CmfCoreExtension.php

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class CmfCoreExtension extends Extension implements PrependExtensionInterface
2626
* Prepend persistence, multilang and other common configuration to all cmf
2727
* bundles.
2828
*
29-
* {@inheritDoc}
29+
* {@inheritdoc}
3030
*/
3131
public function prepend(ContainerBuilder $container)
3232
{
@@ -60,8 +60,8 @@ public function prepend(ContainerBuilder $container)
6060
'use_sonata_admin' => $persistenceConfig['use_sonata_admin'],
6161
'block_basepath' => $persistenceConfig['basepath'].'/content',
6262
'manager_name' => $persistenceConfig['manager_name'],
63-
)
64-
)
63+
),
64+
),
6565
);
6666
break;
6767
case 'cmf_content':
@@ -71,17 +71,17 @@ public function prepend(ContainerBuilder $container)
7171
'enabled' => $persistenceConfig['enabled'],
7272
'use_sonata_admin' => $persistenceConfig['use_sonata_admin'],
7373
'content_basepath' => $persistenceConfig['basepath'].'/content',
74-
)
75-
)
74+
),
75+
),
7676
);
7777
break;
7878
case 'cmf_create':
7979
$prependConfig = array(
8080
'persistence' => array(
8181
'phpcr' => array(
8282
'enabled' => $persistenceConfig['enabled'],
83-
)
84-
)
83+
),
84+
),
8585
);
8686
// if cmf_media is there, it will prepend the image path to its media_basepath
8787
// setting.
@@ -99,8 +99,8 @@ public function prepend(ContainerBuilder $container)
9999
'enabled' => $persistenceConfig['enabled'],
100100
'media_basepath' => $persistenceConfig['basepath'].'/media',
101101
'manager_name' => $persistenceConfig['manager_name'],
102-
)
103-
)
102+
),
103+
),
104104
);
105105
break;
106106
case 'cmf_menu':
@@ -112,8 +112,8 @@ public function prepend(ContainerBuilder $container)
112112
'content_basepath' => $persistenceConfig['basepath'].'/content',
113113
'menu_basepath' => $persistenceConfig['basepath'].'/menu',
114114
'manager_name' => $persistenceConfig['manager_name'],
115-
)
116-
)
115+
),
116+
),
117117
);
118118
break;
119119
case 'cmf_routing':
@@ -128,9 +128,9 @@ public function prepend(ContainerBuilder $container)
128128
'content_basepath' => $persistenceConfig['basepath'].'/content',
129129
'route_basepaths' => $routePaths,
130130
'manager_name' => $persistenceConfig['manager_name'],
131-
)
132-
)
133-
)
131+
),
132+
),
133+
),
134134
);
135135

136136
if (isset($bundles['CmfContentBundle'])) {
@@ -155,8 +155,8 @@ public function prepend(ContainerBuilder $container)
155155
'search_basepath' => $persistenceConfig['basepath'].'/content',
156156
'manager_name' => $persistenceConfig['manager_name'],
157157
'manager_registry' => $persistenceConfig['manager_registry'],
158-
)
159-
)
158+
),
159+
),
160160
);
161161
if (!empty($persistenceConfig['translation_strategy'])) {
162162
$prependConfig['persistence']['phpcr']['translation_strategy'] = $persistenceConfig['translation_strategy'];
@@ -171,17 +171,17 @@ public function prepend(ContainerBuilder $container)
171171
'basepath' => $persistenceConfig['basepath'].'/simple',
172172
'manager_name' => $persistenceConfig['manager_name'],
173173
'manager_registry' => $persistenceConfig['manager_registry'],
174-
)
175-
)
174+
),
175+
),
176176
);
177177
break;
178178
case 'cmf_tree_browser':
179179
$prependConfig = array(
180180
'persistence' => array(
181181
'phpcr' => array(
182182
'enabled' => $persistenceConfig['enabled'],
183-
)
184-
)
183+
),
184+
),
185185
);
186186
break;
187187
case 'cmf_seo':
@@ -220,9 +220,9 @@ public function prepend(ContainerBuilder $container)
220220
'orm' => array(
221221
'enabled' => $persistenceConfig['enabled'],
222222
'manager_name' => $persistenceConfig['manager_name'],
223-
)
224-
)
225-
)
223+
),
224+
),
225+
),
226226
);
227227

228228
if (isset($bundles['CmfContentBundle'])) {
@@ -252,7 +252,7 @@ public function prepend(ContainerBuilder $container)
252252
}
253253

254254
/**
255-
* {@inheritDoc}
255+
* {@inheritdoc}
256256
*/
257257
public function load(array $configs, ContainerBuilder $container)
258258
{
@@ -262,13 +262,13 @@ public function load(array $configs, ContainerBuilder $container)
262262
$loader->load('services.xml');
263263

264264
if ($config['persistence']['phpcr']['enabled']) {
265-
$container->setParameter($this->getAlias() . '.persistence.phpcr.manager_name', $config['persistence']['phpcr']['manager_name']);
266-
$container->setParameter($this->getAlias() . '.persistence.phpcr.basepath', $config['persistence']['phpcr']['basepath']);
265+
$container->setParameter($this->getAlias().'.persistence.phpcr.manager_name', $config['persistence']['phpcr']['manager_name']);
266+
$container->setParameter($this->getAlias().'.persistence.phpcr.basepath', $config['persistence']['phpcr']['basepath']);
267267

268-
$templatingHelper = $container->getDefinition($this->getAlias() . '.templating.helper');
268+
$templatingHelper = $container->getDefinition($this->getAlias().'.templating.helper');
269269
$templatingHelper->addMethodCall('setDoctrineRegistry', array(
270270
new Reference($config['persistence']['phpcr']['manager_registry']),
271-
'%cmf_core.persistence.phpcr.manager_name%'
271+
'%cmf_core.persistence.phpcr.manager_name%',
272272
));
273273

274274
if ($config['persistence']['phpcr']['use_sonata_admin']) {
@@ -282,10 +282,10 @@ public function load(array $configs, ContainerBuilder $container)
282282
}
283283

284284
if (isset($config['multilang'])) {
285-
$container->setParameter($this->getAlias() . '.multilang.locales', $config['multilang']['locales']);
285+
$container->setParameter($this->getAlias().'.multilang.locales', $config['multilang']['locales']);
286286
$loader->load('translatable.xml');
287287
if (!empty($config['persistence']['phpcr']['translation_strategy'])) {
288-
$container->setParameter($this->getAlias() . '.persistence.phpcr.translation_strategy', $config['persistence']['phpcr']['translation_strategy']);
288+
$container->setParameter($this->getAlias().'.persistence.phpcr.translation_strategy', $config['persistence']['phpcr']['translation_strategy']);
289289
} else {
290290
$container->removeDefinition('cmf_core.persistence.phpcr.translatable_metadata_listener');
291291
}
@@ -295,7 +295,7 @@ public function load(array $configs, ContainerBuilder $container)
295295

296296
foreach ($config['sonata_admin']['extensions'] as $extensionName => $options) {
297297
foreach ($options as $key => $value) {
298-
$container->setParameter('cmf_core.sonata_admin.extension.' . $extensionName . '.' . $key, $value);
298+
$container->setParameter('cmf_core.sonata_admin.extension.'.$extensionName.'.'.$key, $value);
299299
}
300300
}
301301

@@ -314,7 +314,7 @@ public function loadSonataPhpcrAdmin($config, XmlFileLoader $loader, ContainerBu
314314
}
315315

316316
/**
317-
* Setup the cmf_core_checkbox_url_label form type if the routing bundle is there
317+
* Setup the cmf_core_checkbox_url_label form type if the routing bundle is there.
318318
*
319319
* @param ContainerBuilder $container
320320
* @param LoaderInterface $loader
@@ -348,29 +348,29 @@ private function loadPublishWorkflow($config, XmlFileLoader $loader, ContainerBu
348348
$loader->load('publish-workflow.xml');
349349

350350
if (!$config['request_listener']) {
351-
$container->removeDefinition($this->getAlias() . '.publish_workflow.request_listener');
351+
$container->removeDefinition($this->getAlias().'.publish_workflow.request_listener');
352352
} elseif (!class_exists('Symfony\Cmf\Bundle\RoutingBundle\Routing\DynamicRouter')) {
353353
throw new InvalidConfigurationException('The "publish_workflow.request_listener" may not be enabled unless "Symfony\Cmf\Bundle\RoutingBundle\Routing\DynamicRouter" is available.');
354354
}
355355

356356
if (!class_exists('Sonata\AdminBundle\Admin\AdminExtension')) {
357-
$container->removeDefinition($this->getAlias() . '.admin_extension.publish_workflow.publishable');
358-
$container->removeDefinition($this->getAlias() . '.admin_extension.publish_workflow.time_period');
357+
$container->removeDefinition($this->getAlias().'.admin_extension.publish_workflow.publishable');
358+
$container->removeDefinition($this->getAlias().'.admin_extension.publish_workflow.time_period');
359359
}
360360

361361
$container->setAlias('cmf_core.publish_workflow.checker', $config['checker_service']);
362362
}
363363

364364
/**
365-
* {@inheritDoc}
365+
* {@inheritdoc}
366366
*/
367367
public function getXsdValidationBasePath()
368368
{
369369
return __DIR__.'/../Resources/config/schema';
370370
}
371371

372372
/**
373-
* {@inheritDoc}
373+
* {@inheritdoc}
374374
*/
375375
public function getNamespace()
376376
{

DependencyInjection/Compiler/AddPublishedVotersPass.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/*
44
* This file is part of the Symfony CMF package.
55
*
6-
* (c) 2011-2014 Symfony CMF
6+
* (c) 2011-2015 Symfony CMF
77
*
88
* For the full copyright and license information, please view the LICENSE
99
* file that was distributed with this source code.
@@ -29,7 +29,7 @@ class AddPublishedVotersPass implements CompilerPassInterface
2929
/**
3030
* Register all cmf_published_voter services.
3131
*
32-
* {@inheritDoc}
32+
* {@inheritdoc}
3333
*/
3434
public function process(ContainerBuilder $container)
3535
{

DependencyInjection/Compiler/DoctrineOrmMappingsPass.php

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/*
44
* This file is part of the Symfony CMF package.
55
*
6-
* (c) 2011-2014 Symfony CMF
6+
* (c) 2011-2015 Symfony CMF
77
*
88
* For the full copyright and license information, please view the LICENSE
99
* file that was distributed with this source code.
@@ -19,7 +19,7 @@
1919

2020
/**
2121
* Forward compatibility class to work with Symfony < 2.3 and/or
22-
* Doctrine ORM bundle < 1.2.1
22+
* Doctrine ORM bundle < 1.2.1.
2323
*
2424
* @author David Buchmann <[email protected]>
2525
*/
@@ -61,7 +61,7 @@ public function __construct($driver, $namespaces, array $managerParameters, $ena
6161
*/
6262
public function process(ContainerBuilder $container)
6363
{
64-
if (! $this->enabledParameter
64+
if (!$this->enabledParameter
6565
|| !$container->hasParameter($this->enabledParameter)
6666
) {
6767
return;
@@ -94,24 +94,25 @@ protected function getChainDriverServiceName(ContainerBuilder $container)
9494

9595
throw new ParameterNotFoundException('None of the managerParameters resulted in a valid name');
9696
}
97+
9798
/**
9899
* Create a mapping with the bundle namespace aware SymfonyFileLocator.
99100
*
100-
* @param array $mappings Hashmap of directory path to namespace
101-
* @param string[] $managerParameters List of parameters that could tell which object manager name
102-
* your bundle uses. This compiler pass will automatically
103-
* append the parameter name for the default entity manager
104-
* to this list.
105-
* @param boolean|string $enabledParameter Service container parameter that must be present to
106-
* enable the mapping. Set to false to not do any check,
107-
* optional.
101+
* @param array $mappings Hashmap of directory path to namespace
102+
* @param string[] $managerParameters List of parameters that could tell which object manager name
103+
* your bundle uses. This compiler pass will automatically
104+
* append the parameter name for the default entity manager
105+
* to this list.
106+
* @param bool|string $enabledParameter Service container parameter that must be present to
107+
* enable the mapping. Set to false to not do any check,
108+
* optional.
108109
*/
109110
public static function createXmlMappingDriver(array $mappings, array $managerParameters = array(), $enabledParameter = false)
110111
{
111112
$arguments = array($mappings, '.orm.xml');
112113
$locator = new Definition('Doctrine\Common\Persistence\Mapping\Driver\SymfonyFileLocator', $arguments);
113114
$driver = new Definition('Doctrine\ORM\Mapping\Driver\XmlDriver', array($locator));
114115

115-
return new DoctrineOrmMappingsPass($driver, $mappings, $managerParameters, $enabledParameter);
116+
return new self($driver, $mappings, $managerParameters, $enabledParameter);
116117
}
117118
}

0 commit comments

Comments
 (0)