Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Commit e69252a

Browse files
committed
Merge pull request #238 from symfony-cmf/styleci
Introduced Style CI
2 parents 8bb9022 + ff13fb2 commit e69252a

Some content is hidden

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

47 files changed

+235
-215
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/AbstractMenuNodeAdmin.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
use Symfony\Cmf\Bundle\MenuBundle\Model\MenuNodeBase;
1919

2020
/**
21-
* Common base admin for Menu and MenuNode
21+
* Common base admin for Menu and MenuNode.
2222
*/
2323
abstract class AbstractMenuNodeAdmin extends Admin
2424
{
@@ -46,7 +46,7 @@ protected function configureListFields(ListMapper $listMapper)
4646
}
4747

4848
/**
49-
* {@inheritDoc}
49+
* {@inheritdoc}
5050
*/
5151
protected function configureFormFields(FormMapper $formMapper)
5252
{

Admin/Extension/MenuNodeReferrersExtension.php

Lines changed: 1 addition & 1 deletion
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.

Admin/Extension/MenuOptionsExtension.php

Lines changed: 7 additions & 7 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.
@@ -28,13 +28,13 @@ class MenuOptionsExtension extends AdminExtension
2828
protected $formGroup;
2929

3030
/**
31-
* @var bool
32-
*/
31+
* @var bool
32+
*/
3333
protected $advanced;
3434

3535
/**
3636
* @param string $formGroup - group to use for form mapper
37-
* @param bool $advanced - activates editing all fields of the node
37+
* @param bool $advanced - activates editing all fields of the node
3838
*/
3939
public function __construct($formGroup = 'form.group_menu_options', $advanced = false)
4040
{
@@ -43,7 +43,7 @@ public function __construct($formGroup = 'form.group_menu_options', $advanced =
4343
}
4444

4545
/**
46-
* {@inheritDoc}
46+
* {@inheritdoc}
4747
*/
4848
public function configureFormFields(FormMapper $formMapper)
4949
{
@@ -64,14 +64,14 @@ public function configureFormFields(FormMapper $formMapper)
6464
)
6565
->end();
6666

67-
if (! $this->advanced) {
67+
if (!$this->advanced) {
6868
return;
6969
}
7070

7171
$child_options = array(
7272
'value_type' => 'text',
7373
'label' => false,
74-
'attr'=> array('style' => 'clear:both')
74+
'attr' => array('style' => 'clear:both'),
7575
);
7676

7777
$formMapper->with($this->formGroup, array(

Admin/MenuAdmin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
class MenuAdmin extends AbstractMenuNodeAdmin
1818
{
1919
/**
20-
* {@inheritDoc}
20+
* {@inheritdoc}
2121
*/
2222
protected function configureFormFields(FormMapper $formMapper)
2323
{

Admin/MenuNodeAdmin.php

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,10 @@
1111

1212
namespace Symfony\Cmf\Bundle\MenuBundle\Admin;
1313

14-
use Symfony\Component\Form\FormBuilder;
1514
use Symfony\Component\Form\FormEvent;
1615
use Symfony\Component\Form\FormEvents;
1716
use Sonata\AdminBundle\Datagrid\ListMapper;
1817
use Sonata\AdminBundle\Form\FormMapper;
19-
use Sonata\DoctrinePHPCRAdminBundle\Admin\Admin;
20-
use Symfony\Cmf\Bundle\MenuBundle\Model\Menu;
2118
use Symfony\Cmf\Bundle\MenuBundle\Model\MenuNode;
2219
use Knp\Menu\ItemInterface as MenuItemInterface;
2320
use Doctrine\Common\Util\ClassUtils;
@@ -37,7 +34,7 @@ protected function configureListFields(ListMapper $listMapper)
3734
}
3835

3936
/**
40-
* {@inheritDoc}
37+
* {@inheritdoc}
4138
*/
4239
protected function configureFormFields(FormMapper $formMapper)
4340
{
@@ -46,7 +43,7 @@ protected function configureFormFields(FormMapper $formMapper)
4643
->add('parent', 'doctrine_phpcr_odm_tree', array(
4744
'root_node' => $this->menuRoot,
4845
'choice_list' => array(),
49-
'select_root_node' => true
46+
'select_root_node' => true,
5047
))
5148
->end()
5249
;
@@ -64,14 +61,14 @@ protected function configureFormFields(FormMapper $formMapper)
6461
'content' => array('content', 'doctrine_phpcr_odm_tree'),
6562
),
6663
'empty_value' => 'auto',
67-
'required' => false
64+
'required' => false,
6865
))
6966
->add('link', 'text', array('required' => false, 'mapped' => false))
7067
->add('content', 'doctrine_phpcr_odm_tree',
7168
array(
7269
'root_node' => $this->contentRoot,
7370
'choice_list' => array(),
74-
'required' => false
71+
'required' => false,
7572
)
7673
)
7774
->end()
@@ -146,18 +143,18 @@ public function getFormBuilder()
146143
break;
147144
}
148145
});
149-
146+
150147
return $formBuilder;
151148
}
152149

153150
/**
154-
* {@inheritDoc}
151+
* {@inheritdoc}
155152
*/
156153
public function buildBreadcrumbs($action, MenuItemInterface $menu = null)
157154
{
158155
$menuNodeNode = parent::buildBreadcrumbs($action, $menu);
159156

160-
if ($action != 'edit' || ! $this->recursiveBreadcrumbs) {
157+
if ($action != 'edit' || !$this->recursiveBreadcrumbs) {
161158
return $menuNodeNode;
162159
}
163160

@@ -176,7 +173,7 @@ public function buildBreadcrumbs($action, MenuItemInterface $menu = null)
176173
if ($parentAdmin->isGranted('EDIT' && $parentAdmin->hasRoute('edit'))) {
177174
$parentEditNode->setUri(
178175
$parentAdmin->generateUrl('edit', array(
179-
'id' => $this->getUrlsafeIdentifier($parentDoc)
176+
'id' => $this->getUrlsafeIdentifier($parentDoc),
180177
))
181178
);
182179
}
@@ -191,5 +188,4 @@ public function setRecursiveBreadcrumbs($recursiveBreadcrumbs)
191188
{
192189
$this->recursiveBreadcrumbs = (bool) $recursiveBreadcrumbs;
193190
}
194-
195191
}

CmfMenuBundle.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ public function build(ContainerBuilder $container)
2828
$container->addCompilerPass(
2929
DoctrinePhpcrMappingsPass::createXmlMappingDriver(
3030
array(
31-
realpath(__DIR__ . '/Resources/config/doctrine-model') => 'Symfony\Cmf\Bundle\MenuBundle\Model',
32-
realpath(__DIR__ . '/Resources/config/doctrine-phpcr') => 'Symfony\Cmf\Bundle\MenuBundle\Doctrine\Phpcr',
31+
realpath(__DIR__.'/Resources/config/doctrine-model') => 'Symfony\Cmf\Bundle\MenuBundle\Model',
32+
realpath(__DIR__.'/Resources/config/doctrine-phpcr') => 'Symfony\Cmf\Bundle\MenuBundle\Doctrine\Phpcr',
3333
),
3434
array('cmf_menu.manager_name'),
3535
false,

DependencyInjection/CmfMenuExtension.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
1616
use Symfony\Component\DependencyInjection\ContainerBuilder;
1717
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
18-
use Symfony\Component\DependencyInjection\Reference;
1918
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
2019
use Symfony\Cmf\Bundle\RoutingBundle\Routing\DynamicRouter;
2120

@@ -33,7 +32,7 @@ public function load(array $configs, ContainerBuilder $container)
3332

3433
$loader->load('menu.xml');
3534
$container->setAlias('cmf_menu.content_router', $config['content_url_generator']);
36-
$container->setParameter($this->getAlias() . '.allow_empty_items', $config['allow_empty_items']);
35+
$container->setParameter($this->getAlias().'.allow_empty_items', $config['allow_empty_items']);
3736

3837
$this->loadVoters($config, $loader, $container);
3938

@@ -56,14 +55,14 @@ public function loadVoters($config, XmlFileLoader $loader, ContainerBuilder $con
5655

5756
if (isset($config['voters']['content_identity'])) {
5857
if (empty($config['voters']['content_identity']['content_key'])) {
59-
if (! class_exists('Symfony\\Cmf\\Bundle\\RoutingBundle\\Routing\\DynamicRouter')) {
58+
if (!class_exists('Symfony\\Cmf\\Bundle\\RoutingBundle\\Routing\\DynamicRouter')) {
6059
throw new \RuntimeException('You need to set the content_key when not using the CmfRoutingBundle DynamicRouter');
6160
}
6261
$contentKey = DynamicRouter::CONTENT_KEY;
6362
} else {
6463
$contentKey = $config['voters']['content_identity']['content_key'];
6564
}
66-
$container->setParameter($this->getAlias() . '.content_key', $contentKey);
65+
$container->setParameter($this->getAlias().'.content_key', $contentKey);
6766
} else {
6867
$container->removeDefinition('cmf_menu.current_item_voter.content_identity');
6968
}
@@ -89,7 +88,7 @@ public function loadPhpcr($config, XmlFileLoader $loader, ContainerBuilder $cont
8988

9089
foreach ($keys as $sourceKey => $targetKey) {
9190
$container->setParameter(
92-
$this->getAlias() . '.persistence.phpcr.'. $targetKey,
91+
$this->getAlias().'.persistence.phpcr.'.$targetKey,
9392
$config[$sourceKey]
9493
);
9594
}
@@ -112,7 +111,7 @@ public function loadSonataAdmin($config, XmlFileLoader $loader, ContainerBuilder
112111
foreach (array('menu', 'node') as $key) {
113112
if (isset($config[$key.'_admin_class'])) {
114113
$container->setParameter(
115-
$this->getAlias() . '.persistence.phpcr.'.$key.'_admin.class',
114+
$this->getAlias().'.persistence.phpcr.'.$key.'_admin.class',
116115
$config[$key.'_admin_class']
117116
);
118117
}
@@ -137,7 +136,7 @@ public function loadExtensions($config, XmlFileLoader $loader, ContainerBuilder
137136
throw new InvalidConfigurationException('To use advanced menu options, you need the burgov/key-value-form-bundle in your project.');
138137
}
139138

140-
$container->setParameter($this->getAlias() . '.admin_extensions.menu_options.advanced', $config['admin_extensions']['menu_options']['advanced']);
139+
$container->setParameter($this->getAlias().'.admin_extensions.menu_options.advanced', $config['admin_extensions']['menu_options']['advanced']);
141140

142141
$loader->load('admin-extension.xml');
143142
}

DependencyInjection/Configuration.php

Lines changed: 1 addition & 1 deletion
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.

Doctrine/Phpcr/Menu.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.
@@ -30,7 +30,7 @@ public function setParentDocument($parent)
3030
}
3131

3232
/**
33-
* Returns the parent of this menu node
33+
* Returns the parent of this menu node.
3434
*
3535
* @return object
3636
*/

0 commit comments

Comments
 (0)