Skip to content

Commit c715d96

Browse files
authored
Merge pull request #360 from symfony-cmf/styleci
cleanup styleci
2 parents b35b7f0 + 5504898 commit c715d96

24 files changed

+110
-103
lines changed

.styleci.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
preset: symfony
22

3-
disabled: [phpdoc_to_comment, phpdoc_var_without_name]
3+
enabled:
4+
- ordered_use
5+
- short_array_syntax
6+
7+
disabled:
8+
- phpdoc_to_comment
9+
- phpdoc_var_without_name
10+
- single_line_class_definition
411

512
finder:
613
exclude: [var]

app/AppKernel.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
use Symfony\Component\HttpKernel\Kernel;
1312
use Symfony\Component\Config\Loader\LoaderInterface;
13+
use Symfony\Component\HttpKernel\Kernel;
1414

1515
class AppKernel extends Kernel
1616
{
1717
public function registerBundles()
1818
{
19-
$bundles = array(
19+
$bundles = [
2020
// enable symfony-standard bundles
2121
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
2222
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
@@ -68,9 +68,9 @@ public function registerBundles()
6868

6969
// and the app bundle
7070
new AppBundle\AppBundle(),
71-
);
71+
];
7272

73-
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
73+
if (in_array($this->getEnvironment(), ['dev', 'test'])) {
7474
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
7575
$bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
7676
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();

app/autoload.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
use Doctrine\Common\Annotations\AnnotationRegistry;
1312
use Composer\Autoload\ClassLoader;
13+
use Doctrine\Common\Annotations\AnnotationRegistry;
1414

1515
/**
1616
* @var ClassLoader $loader
1717
*/
1818
$loader = require __DIR__.'/../vendor/autoload.php';
1919

20-
AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
20+
AnnotationRegistry::registerLoader([$loader, 'loadClass']);
2121

2222
return $loader;

src/AppBundle/Controller/ContentController.php

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

1212
namespace AppBundle\Controller;
1313

14-
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
15-
use Symfony\Component\HttpFoundation\Response;
1614
use Symfony\Cmf\Bundle\ContentBundle\Controller\ContentController as BaseContentController;
15+
use Symfony\Component\HttpFoundation\Response;
16+
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
1717

1818
/**
1919
* Special routes to demo the features of the Doctrine Router in the CmfRoutingBundle.
@@ -35,10 +35,10 @@ public function typeAction($contentDocument)
3535
throw new NotFoundHttpException('Content not found');
3636
}
3737

38-
$params = array(
38+
$params = [
3939
'cmfMainContent' => $contentDocument,
4040
'info' => 'This page is rendered by <code>'.__METHOD__.'</code>. This controller was configured for this route type.',
41-
);
41+
];
4242

4343
return $this->renderResponse('demo/controller.html.twig', $params);
4444
}
@@ -58,10 +58,10 @@ public function classAction($contentDocument)
5858
throw new NotFoundHttpException('Content not found');
5959
}
6060

61-
$params = array(
61+
$params = [
6262
'cmfMainContent' => $contentDocument,
6363
'info' => 'This page is rendered by <code>'.__METHOD__.'</code>. This controller will be called for content objects that are instances of <code>AppBundle\Document\DemoClassContent</code>.',
64-
);
64+
];
6565

6666
return $this->renderResponse('demo/controller.html.twig', $params);
6767
}
@@ -81,10 +81,10 @@ public function specialAction($contentDocument)
8181
throw new NotFoundHttpException('Content not found');
8282
}
8383

84-
$params = array(
84+
$params = [
8585
'cmfMainContent' => $contentDocument,
8686
'info' => 'This page is rendered by <code>'.__METHOD__.'</code>. This controller was explicitely defined for the route by setting the <code>_controller</code> default.',
87-
);
87+
];
8888

8989
return $this->renderResponse('demo/controller.html.twig', $params);
9090
}

src/AppBundle/Controller/DefaultController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
namespace AppBundle\Controller;
1313

1414
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
15+
use Sonata\BlockBundle\Model\BlockInterface;
1516
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
1617
use Symfony\Component\HttpFoundation\Response;
17-
use Sonata\BlockBundle\Model\BlockInterface;
1818

1919
class DefaultController extends Controller
2020
{
@@ -27,9 +27,9 @@ class DefaultController extends Controller
2727
*/
2828
public function blockAction($block)
2929
{
30-
return $this->render('block/demo_action_block.html.twig', array(
30+
return $this->render('block/demo_action_block.html.twig', [
3131
'block' => $block,
32-
));
32+
]);
3333
}
3434

3535
/**

src/AppBundle/Controller/SecurityController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ public function loginAction(Request $request)
2626
$error = $authenticationUtils->getLastAuthenticationError();
2727
$lastUsername = $authenticationUtils->getLastUsername();
2828

29-
return $this->render('security/login.html.twig', array(
29+
return $this->render('security/login.html.twig', [
3030
'last_username' => $lastUsername,
3131
'error' => $error,
32-
));
32+
]);
3333
}
3434

3535
/**

src/AppBundle/DataFixtures/PHPCR/LoadMenuData.php

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

1212
namespace AppBundle\DataFixtures\PHPCR;
1313

14-
use Doctrine\ODM\PHPCR\DocumentManager;
1514
use Doctrine\Common\DataFixtures\FixtureInterface;
1615
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
1716
use Doctrine\Common\Persistence\ObjectManager;
17+
use Doctrine\ODM\PHPCR\DocumentManager;
1818
use PHPCR\Util\NodeHelper;
19-
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
20-
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
21-
use Symfony\Cmf\Bundle\MenuBundle\Doctrine\Phpcr\MenuNode;
2219
use Symfony\Cmf\Bundle\MenuBundle\Doctrine\Phpcr\Menu;
20+
use Symfony\Cmf\Bundle\MenuBundle\Doctrine\Phpcr\MenuNode;
21+
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
22+
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
2323

2424
class LoadMenuData implements ContainerAwareInterface, FixtureInterface, OrderedFixtureInterface
2525
{
@@ -48,19 +48,19 @@ public function load(ObjectManager $manager)
4848
NodeHelper::createPath($session, $basepath);
4949
$root = $manager->find(null, $basepath);
5050

51-
$labels = array('en' => 'Home', 'de' => 'Start', 'fr' => 'Accueil');
51+
$labels = ['en' => 'Home', 'de' => 'Start', 'fr' => 'Accueil'];
5252
/** @var $main Menu */
5353
$main = $this->createMenuNode($manager, $root, 'main', $labels, $manager->find(null, "$content_path/home"));
54-
$main->setChildrenAttributes(array('class' => 'menu_main'));
54+
$main->setChildrenAttributes(['class' => 'menu_main']);
5555

5656
$this->createMenuNode($manager, $main, 'admin-item', 'Admin', null, null, 'sonata_admin_dashboard');
5757

58-
$projects = $this->createMenuNode($manager, $main, 'projects-item', array('en' => 'Projects', 'de' => 'Projekte', 'fr' => 'Projets'), $manager->find(null, "$content_path/projects"));
58+
$projects = $this->createMenuNode($manager, $main, 'projects-item', ['en' => 'Projects', 'de' => 'Projekte', 'fr' => 'Projets'], $manager->find(null, "$content_path/projects"));
5959
$this->createMenuNode($manager, $projects, 'cmf-item', 'Symfony CMF', $manager->find(null, "$content_path/cmf"));
6060

61-
$company = $this->createMenuNode($manager, $main, 'company-item', array('en' => 'Company', 'de' => 'Firma', 'fr' => 'Entreprise'), $manager->find(null, "$content_path/company"));
62-
$this->createMenuNode($manager, $company, 'team-item', array('en' => 'Team', 'de' => 'Team', 'fr' => 'Equipe'), $manager->find(null, "$content_path/team"));
63-
$this->createMenuNode($manager, $company, 'more-item', array('en' => 'More', 'de' => 'Mehr', 'fr' => 'Plus'), $manager->find(null, "$content_path/more"));
61+
$company = $this->createMenuNode($manager, $main, 'company-item', ['en' => 'Company', 'de' => 'Firma', 'fr' => 'Entreprise'], $manager->find(null, "$content_path/company"));
62+
$this->createMenuNode($manager, $company, 'team-item', ['en' => 'Team', 'de' => 'Team', 'fr' => 'Equipe'], $manager->find(null, "$content_path/team"));
63+
$this->createMenuNode($manager, $company, 'more-item', ['en' => 'More', 'de' => 'Mehr', 'fr' => 'Plus'], $manager->find(null, "$content_path/more"));
6464

6565
$this->createMenuNode($manager, $main, 'about', 'About us', $manager->find(null, "$content_path/about"));
6666
$this->createMenuNode($manager, $main, 'contact', 'Contact', $manager->find(null, "$content_path/contact"));
@@ -78,15 +78,15 @@ public function load(ObjectManager $manager)
7878
$this->createMenuNode($manager, $publicationDemo, 'not-published', 'Not published', $manager->find(null, "$content_path/not_published"));
7979
$this->createMenuNode($manager, $publicationDemo, 'published-tomorrow', 'Published tomorrow', $manager->find(null, "$content_path/published_tomorrow"));
8080

81-
$singlelocale = $this->createMenuNode($manager, $main, 'singlelocale-item', array('en' => 'singlelocale'), $manager->find(null, "$content_path/singlelocale"));
82-
$this->createMenuNode($manager, $singlelocale, 'singlelocale-sub-item', array('en' => 'singlelocale child'), $manager->find(null, "$content_path/singlelocale"));
81+
$singlelocale = $this->createMenuNode($manager, $main, 'singlelocale-item', ['en' => 'singlelocale'], $manager->find(null, "$content_path/singlelocale"));
82+
$this->createMenuNode($manager, $singlelocale, 'singlelocale-sub-item', ['en' => 'singlelocale child'], $manager->find(null, "$content_path/singlelocale"));
8383

8484
$seo = $this->createMenuNode($manager, $main, 'seo', 'SEO', $manager->find(null, "$content_path/simple-seo-example"));
85-
$this->createMenuNode($manager, $seo, 'simple-seo-example', array('en' => 'Seo-Simple-Content'), $manager->find(null, "$content_path/simple-seo-example"));
86-
$this->createMenuNode($manager, $seo, 'demo-seo-extractor', array('en' => 'Seo-Extractor'), $manager->find(null, "$content_path/demo-seo-extractor"));
87-
$this->createMenuNode($manager, $seo, 'simple-seo-property', array('en' => 'Seo-Extra-Properties'), $manager->find(null, "$content_path/simple-seo-property"));
85+
$this->createMenuNode($manager, $seo, 'simple-seo-example', ['en' => 'Seo-Simple-Content'], $manager->find(null, "$content_path/simple-seo-example"));
86+
$this->createMenuNode($manager, $seo, 'demo-seo-extractor', ['en' => 'Seo-Extractor'], $manager->find(null, "$content_path/demo-seo-extractor"));
87+
$this->createMenuNode($manager, $seo, 'simple-seo-property', ['en' => 'Seo-Extra-Properties'], $manager->find(null, "$content_path/simple-seo-property"));
8888

89-
$this->createMenuNode($manager, $main, 'routing-auto-item', array('en' => 'Auto routing example', 'de' => 'Auto routing beispiel', 'fr' => 'Auto routing exemple'), $manager->find(null, "$content_path/news/RoutingAutoBundle generates routes!"));
89+
$this->createMenuNode($manager, $main, 'routing-auto-item', ['en' => 'Auto routing example', 'de' => 'Auto routing beispiel', 'fr' => 'Auto routing exemple'], $manager->find(null, "$content_path/news/RoutingAutoBundle generates routes!"));
9090

9191
$manager->flush();
9292
}

src/AppBundle/DataFixtures/PHPCR/LoadNewsData.php

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

1212
namespace AppBundle\DataFixtures\PHPCR;
1313

14+
use AppBundle\Document\DemoNewsContent;
1415
use Doctrine\Common\DataFixtures\FixtureInterface;
1516
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
1617
use Doctrine\Common\Persistence\ObjectManager;
1718
use Doctrine\ODM\PHPCR\DocumentManager;
18-
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
19-
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
2019
use PHPCR\Util\NodeHelper;
21-
use AppBundle\Document\DemoNewsContent;
20+
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
21+
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
2222

2323
class LoadNewsData implements ContainerAwareInterface, FixtureInterface, OrderedFixtureInterface
2424
{

src/AppBundle/DataFixtures/PHPCR/LoadRoutingData.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
use PHPCR\Util\NodeHelper;
1919
use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\RedirectRoute;
2020
use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\Route;
21-
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
22-
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
2321
use Symfony\Cmf\Component\Routing\RouteObjectInterface;
22+
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
23+
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
2424

2525
class LoadRoutingData implements ContainerAwareInterface, FixtureInterface, OrderedFixtureInterface
2626
{

src/AppBundle/DataFixtures/PHPCR/LoadStaticPageData.php

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

1212
namespace AppBundle\DataFixtures\PHPCR;
1313

14+
use AppBundle\Document\DemoSeoContent;
1415
use Doctrine\Common\DataFixtures\FixtureInterface;
1516
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
1617
use Doctrine\Common\Persistence\ObjectManager;
1718
use Doctrine\ODM\PHPCR\DocumentManager;
1819
use PHPCR\Util\NodeHelper;
19-
use AppBundle\Document\DemoSeoContent;
2020
use Symfony\Cmf\Bundle\SeoBundle\Doctrine\Phpcr\SeoMetadata;
21-
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
2221
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
22+
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
2323
use Symfony\Component\Yaml\Parser;
2424

2525
class LoadStaticPageData implements ContainerAwareInterface, FixtureInterface, OrderedFixtureInterface

src/AppBundle/Document/DemoClassContent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
namespace AppBundle\Document;
1313

1414
use Doctrine\ODM\PHPCR\Mapping\Annotations as PHPCRODM;
15-
use Symfony\Component\Validator\Constraints as Assert;
1615
use Symfony\Cmf\Component\Routing\RouteReferrersReadInterface;
16+
use Symfony\Component\Validator\Constraints as Assert;
1717

1818
/**
1919
* A document that we map to a controller.

src/AppBundle/Document/DemoSeoContent.php

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

1414
use Doctrine\ODM\PHPCR\Mapping\Annotations as PHPCRODM;
1515
use Symfony\Cmf\Bundle\ContentBundle\Doctrine\Phpcr\StaticContent;
16-
use Symfony\Cmf\Bundle\SeoBundle\SeoAwareInterface;
1716
use Symfony\Cmf\Bundle\SeoBundle\Doctrine\Phpcr\SeoMetadata;
17+
use Symfony\Cmf\Bundle\SeoBundle\SeoAwareInterface;
1818

1919
/**
2020
* That example class uses the extractors for the creation of the SeoMetadata.

src/AppBundle/Document/DemoTemplateContent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
namespace AppBundle\Document;
1313

1414
use Doctrine\ODM\PHPCR\Mapping\Annotations as PHPCRODM;
15-
use Symfony\Component\Validator\Constraints as Assert;
1615
use Symfony\Cmf\Component\Routing\RouteReferrersReadInterface;
16+
use Symfony\Component\Validator\Constraints as Assert;
1717

1818
/**
1919
* A document that we map to a template to be used with the generic content

src/AppBundle/EventListener/SandboxExceptionListener.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
namespace AppBundle\EventListener;
1313

1414
use PHPCR\RepositoryException;
15-
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
1615
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
16+
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
1717
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
1818
use Symfony\Component\HttpFoundation\Response;
19-
use Symfony\Component\HttpKernel\KernelEvents;
2019
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
2120
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
21+
use Symfony\Component\HttpKernel\KernelEvents;
2222

2323
/**
2424
* Exception listener that will handle not found exceptions and try to give the
@@ -75,8 +75,8 @@ public function onKernelException(GetResponseForExceptionEvent $event)
7575

7676
public static function getSubscribedEvents()
7777
{
78-
return array(
79-
KernelEvents::EXCEPTION => array('onKernelException', 0),
80-
);
78+
return [
79+
KernelEvents::EXCEPTION => ['onKernelException', 0],
80+
];
8181
}
8282
}

src/AppBundle/Security/ResourceVoter.php

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

1212
namespace AppBundle\Security;
1313

14-
use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
1514
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
15+
use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
1616

1717
class ResourceVoter implements VoterInterface
1818
{

src/AppBundle/Twig/MenuExtension.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ public function __construct(Helper $helper, MatcherInterface $matcher)
2828

2929
public function getFunctions()
3030
{
31-
return array(
32-
new \Twig_SimpleFunction('app_get_current_menu_item', array($this, 'getCurrent')),
33-
);
31+
return [
32+
new \Twig_SimpleFunction('app_get_current_menu_item', [$this, 'getCurrent']),
33+
];
3434
}
3535

36-
public function getCurrent($menu, array $path = array(), array $options = array())
36+
public function getCurrent($menu, array $path = [], array $options = [])
3737
{
3838
return $this->doGetCurrent($this->helper->get($menu, $path, $options));
3939
}

tests/Functional/AdminDashboardTest.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-2015 Symfony CMF
6+
* (c) 2011-2017 Symfony CMF
77
*
88
* For the full copyright and license information, please view the LICENSE
99
* file that was distributed with this source code.

0 commit comments

Comments
 (0)