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

Commit 01fcbf0

Browse files
authored
Merge pull request #285 from symfony-cmf/analysis-86Geyl
Apply fixes from StyleCI
2 parents 7993690 + 445b7a2 commit 01fcbf0

25 files changed

+171
-171
lines changed

src/CmfMenuBundle.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111

1212
namespace Symfony\Cmf\Bundle\MenuBundle;
1313

14-
use Symfony\Component\HttpKernel\Bundle\Bundle;
15-
use Symfony\Component\DependencyInjection\ContainerBuilder;
14+
use Doctrine\Bundle\PHPCRBundle\DependencyInjection\Compiler\DoctrinePhpcrMappingsPass;
1615
use Symfony\Cmf\Bundle\MenuBundle\DependencyInjection\Compiler\DecorateMenuFactoryPass;
1716
use Symfony\Cmf\Bundle\MenuBundle\DependencyInjection\Compiler\ValidationPass;
18-
use Doctrine\Bundle\PHPCRBundle\DependencyInjection\Compiler\DoctrinePhpcrMappingsPass;
17+
use Symfony\Component\DependencyInjection\ContainerBuilder;
18+
use Symfony\Component\HttpKernel\Bundle\Bundle;
1919

2020
class CmfMenuBundle extends Bundle
2121
{
@@ -29,13 +29,13 @@ public function build(ContainerBuilder $container)
2929
if (class_exists('Doctrine\Bundle\PHPCRBundle\DependencyInjection\Compiler\DoctrinePhpcrMappingsPass')) {
3030
$container->addCompilerPass(
3131
DoctrinePhpcrMappingsPass::createXmlMappingDriver(
32-
array(
32+
[
3333
realpath(__DIR__.'/Resources/config/doctrine-model') => 'Symfony\Cmf\Bundle\MenuBundle\Model',
3434
realpath(__DIR__.'/Resources/config/doctrine-phpcr') => 'Symfony\Cmf\Bundle\MenuBundle\Doctrine\Phpcr',
35-
),
36-
array('cmf_menu.manager_name'),
35+
],
36+
['cmf_menu.manager_name'],
3737
false,
38-
array('CmfMenuBundle' => 'Symfony\Cmf\Bundle\MenuBundle\Doctrine\Phpcr')
38+
['CmfMenuBundle' => 'Symfony\Cmf\Bundle\MenuBundle\Doctrine\Phpcr']
3939
)
4040
);
4141
}

src/DependencyInjection/CmfMenuExtension.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111

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

14+
use Symfony\Cmf\Bundle\RoutingBundle\Routing\DynamicRouter;
1415
use Symfony\Component\Config\FileLocator;
1516
use Symfony\Component\DependencyInjection\ContainerBuilder;
1617
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
1718
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
18-
use Symfony\Cmf\Bundle\RoutingBundle\Routing\DynamicRouter;
1919

2020
class CmfMenuExtension extends Extension
2121
{
@@ -71,14 +71,14 @@ public function loadVoters($config, XmlFileLoader $loader, ContainerBuilder $con
7171

7272
public function loadPhpcr($config, XmlFileLoader $loader, ContainerBuilder $container)
7373
{
74-
$keys = array(
74+
$keys = [
7575
'menu_document_class' => 'menu_document.class',
7676
'node_document_class' => 'node_document.class',
7777
'menu_basepath' => 'menu_basepath',
7878
'content_basepath' => 'content_basepath',
7979
'manager_name' => 'manager_name',
8080
'prefetch' => 'prefetch',
81-
);
81+
];
8282

8383
foreach ($keys as $sourceKey => $targetKey) {
8484
$container->setParameter(

src/DependencyInjection/Compiler/DecorateMenuFactoryPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
namespace Symfony\Cmf\Bundle\MenuBundle\DependencyInjection\Compiler;
1313

1414
use Symfony\Component\DependencyInjection\Alias;
15-
use Symfony\Component\DependencyInjection\ContainerBuilder;
1615
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
16+
use Symfony\Component\DependencyInjection\ContainerBuilder;
1717

1818
class DecorateMenuFactoryPass implements CompilerPassInterface
1919
{

src/DependencyInjection/Compiler/ValidationPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
namespace Symfony\Cmf\Bundle\MenuBundle\DependencyInjection\Compiler;
1313

14-
use Symfony\Component\DependencyInjection\ContainerBuilder;
1514
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
15+
use Symfony\Component\DependencyInjection\ContainerBuilder;
1616

1717
/**
1818
* Register validation files only if their persistence layer is enabled.

src/DependencyInjection/Configuration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function getConfigTreeBuilder()
5959
->addDefaultsIfNotSet()
6060
->children()
6161
->enumNode('enabled')
62-
->values(array(true, false, 'auto'))
62+
->values([true, false, 'auto'])
6363
->defaultValue('auto')
6464
->end()
6565
->end()

src/Extension/ContentExtension.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ public function __construct(UrlGeneratorInterface $contentRouter)
4747
*/
4848
public function buildOptions(array $options)
4949
{
50-
$options = array_merge(array(
50+
$options = array_merge([
5151
'content' => null,
5252
'linkType' => null,
53-
'extras' => array(),
54-
), $options);
53+
'extras' => [],
54+
], $options);
5555

5656
if (null === $options['linkType']) {
5757
$options['linkType'] = $this->determineLinkType($options);
@@ -66,7 +66,7 @@ public function buildOptions(array $options)
6666

6767
$options['uri'] = $this->contentRouter->generate(
6868
$options['content'],
69-
isset($options['routeParameters']) ? $options['routeParameters'] : array(),
69+
isset($options['routeParameters']) ? $options['routeParameters'] : [],
7070
(isset($options['routeAbsolute']) && $options['routeAbsolute']) ? UrlGeneratorInterface::ABSOLUTE_URL : UrlGeneratorInterface::ABSOLUTE_PATH
7171
);
7272
}
@@ -121,7 +121,7 @@ protected function determineLinkType($options)
121121
*/
122122
protected function validateLinkType($linkType)
123123
{
124-
$linkTypes = array('uri', 'route', 'content');
124+
$linkTypes = ['uri', 'route', 'content'];
125125
if (!in_array($linkType, $linkTypes)) {
126126
throw new \InvalidArgumentException(sprintf(
127127
'Invalid link type "%s", expected: "%s"',

src/Model/MenuNode.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
namespace Symfony\Cmf\Bundle\MenuBundle\Model;
1313

1414
use Symfony\Cmf\Bundle\CoreBundle\Model\ChildInterface;
15-
use Symfony\Cmf\Bundle\CoreBundle\Translatable\TranslatableInterface;
16-
use Symfony\Cmf\Bundle\CoreBundle\PublishWorkflow\PublishTimePeriodInterface;
1715
use Symfony\Cmf\Bundle\CoreBundle\PublishWorkflow\PublishableInterface;
16+
use Symfony\Cmf\Bundle\CoreBundle\PublishWorkflow\PublishTimePeriodInterface;
17+
use Symfony\Cmf\Bundle\CoreBundle\Translatable\TranslatableInterface;
1818

1919
/**
2020
* This is the standard CMF MenuNode implementation.
@@ -149,10 +149,10 @@ public function getOptions()
149149
{
150150
$options = parent::getOptions();
151151

152-
return array_merge($options, array(
152+
return array_merge($options, [
153153
'linkType' => $this->linkType,
154154
'content' => $this->getContent(),
155-
));
155+
]);
156156
}
157157

158158
/**

src/Model/MenuNodeBase.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class MenuNodeBase implements NodeInterface
7171
*
7272
* @var array
7373
*/
74-
protected $attributes = array();
74+
protected $attributes = [];
7575

7676
/**
7777
* HTML attributes to add to the children list element.
@@ -80,7 +80,7 @@ class MenuNodeBase implements NodeInterface
8080
*
8181
* @var array
8282
*/
83-
protected $childrenAttributes = array();
83+
protected $childrenAttributes = [];
8484

8585
/**
8686
* HTML attributes to add to items link.
@@ -89,7 +89,7 @@ class MenuNodeBase implements NodeInterface
8989
*
9090
* @var array
9191
*/
92-
protected $linkAttributes = array();
92+
protected $linkAttributes = [];
9393

9494
/**
9595
* HTML attributes to add to the items label.
@@ -98,14 +98,14 @@ class MenuNodeBase implements NodeInterface
9898
*
9999
* @var array
100100
*/
101-
protected $labelAttributes = array();
101+
protected $labelAttributes = [];
102102

103103
/**
104104
* Hashmap for extra stuff associated to the node.
105105
*
106106
* @var array
107107
*/
108-
protected $extras = array();
108+
protected $extras = [];
109109

110110
/**
111111
* Parameters to use when generating the route.
@@ -114,7 +114,7 @@ class MenuNodeBase implements NodeInterface
114114
*
115115
* @var array
116116
*/
117-
protected $routeParameters = array();
117+
protected $routeParameters = [];
118118

119119
/**
120120
* Set to false to not render.
@@ -351,7 +351,7 @@ public function setChildrenAttributes(array $attributes)
351351
*/
352352
public function getChildren()
353353
{
354-
$children = array();
354+
$children = [];
355355
foreach ($this->children as $child) {
356356
if (!$child instanceof NodeInterface) {
357357
continue;
@@ -575,7 +575,7 @@ public function isDisplayable()
575575
*/
576576
public function getOptions()
577577
{
578-
return array(
578+
return [
579579
'uri' => $this->getUri(),
580580
'route' => $this->getRoute(),
581581
'label' => $this->getLabel(),
@@ -587,6 +587,6 @@ public function getOptions()
587587
'routeAbsolute' => $this->getRouteAbsolute(),
588588
'linkAttributes' => $this->getLinkAttributes(),
589589
'labelAttributes' => $this->getLabelAttributes(),
590-
);
590+
];
591591
}
592592
}

src/Provider/PhpcrMenuProvider.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@
1313

1414
use Doctrine\Common\Persistence\ManagerRegistry;
1515
use Doctrine\ODM\PHPCR\DocumentManager;
16-
use Knp\Menu\Loader\NodeLoader;
17-
use PHPCR\RepositoryException;
18-
use Symfony\Component\HttpFoundation\Request;
19-
use PHPCR\PathNotFoundException;
20-
use PHPCR\Util\PathHelper;
2116
use Jackalope\Session;
2217
use Knp\Menu\FactoryInterface;
2318
use Knp\Menu\ItemInterface;
19+
use Knp\Menu\Loader\NodeLoader;
2420
use Knp\Menu\NodeInterface;
2521
use Knp\Menu\Provider\MenuProviderInterface;
22+
use PHPCR\PathNotFoundException;
23+
use PHPCR\RepositoryException;
24+
use PHPCR\Util\PathHelper;
25+
use Symfony\Component\HttpFoundation\Request;
2626

2727
class PhpcrMenuProvider implements MenuProviderInterface
2828
{
@@ -165,7 +165,7 @@ public function setRequest(Request $request = null)
165165
*
166166
* @throws \InvalidArgumentException if the menu can not be found
167167
*/
168-
public function get($name, array $options = array())
168+
public function get($name, array $options = [])
169169
{
170170
$menu = $this->find($name, $options, true);
171171

@@ -189,7 +189,7 @@ public function get($name, array $options = array())
189189
*
190190
* @return bool Whether a menu with this name can be loaded by this provider
191191
*/
192-
public function has($name, array $options = array())
192+
public function has($name, array $options = [])
193193
{
194194
return $this->find($name, $options, false) instanceof NodeInterface;
195195
}

src/PublishWorkflow/CreateMenuItemFromNodeListener.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111

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

14-
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
15-
use Symfony\Cmf\Bundle\MenuBundle\Event\CreateMenuItemFromNodeEvent;
1614
use Symfony\Cmf\Bundle\CoreBundle\PublishWorkflow\PublishWorkflowChecker;
15+
use Symfony\Cmf\Bundle\MenuBundle\Event\CreateMenuItemFromNodeEvent;
16+
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
1717

1818
/**
1919
* Listener for the CREATE_ITEM_FROM_NODE event that skips the node if it is

0 commit comments

Comments
 (0)