Skip to content

Commit 62f44b2

Browse files
authored
Merge pull request #454 from symfony-cmf/fix-cs
codestyle: adjust to symfony default ruleset
2 parents e7f55a6 + c288a64 commit 62f44b2

23 files changed

+44
-76
lines changed

.styleci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
############################################################################
88
# This file is part of the Symfony CMF package. #
99
# #
10-
# (c) 2011-2017 Symfony CMF #
10+
# (c) Symfony CMF i #
1111
# #
1212
# For the full copyright and license information, please view the LICENSE #
1313
# file that was distributed with this source code. #
@@ -16,10 +16,10 @@
1616

1717
preset: symfony
1818

19+
risky: true
20+
1921
enabled:
2022
- combine_consecutive_unsets
21-
- short_array_syntax
22-
- newline_after_open_tag
2323
- no_php4_constructor
2424
- no_useless_else
2525
- ordered_use

src/CmfRoutingBundle.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@
3333
*/
3434
class CmfRoutingBundle extends Bundle
3535
{
36-
/**
37-
* @param ContainerBuilder $container
38-
*/
3936
public function build(ContainerBuilder $container)
4037
{
4138
parent::build($container);
@@ -52,8 +49,6 @@ public function build(ContainerBuilder $container)
5249
/**
5350
* Creates and registers compiler passes for PHPCR-ODM mapping if both the
5451
* phpcr-odm and the phpcr-bundle are present.
55-
*
56-
* @param ContainerBuilder $container
5752
*/
5853
private function buildPhpcrCompilerPass(ContainerBuilder $container)
5954
{
@@ -80,8 +75,6 @@ private function buildPhpcrCompilerPass(ContainerBuilder $container)
8075
/**
8176
* Creates and registers compiler passes for ORM mappings if both doctrine
8277
* ORM and a suitable compiler pass implementation are available.
83-
*
84-
* @param ContainerBuilder $container
8578
*/
8679
private function buildOrmCompilerPass(ContainerBuilder $container)
8780
{

src/Controller/RedirectController.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ public function __construct(RouterInterface $router)
4343
/**
4444
* Action to redirect based on a RedirectRouteInterface route.
4545
*
46-
* @param RedirectRouteInterface $contentDocument
47-
*
4846
* @return \Symfony\Component\HttpFoundation\RedirectResponse the response
4947
*/
5048
public function redirectAction(RedirectRouteInterface $contentDocument)

src/DependencyInjection/CmfRoutingExtension.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ private function setupFormTypes(array $config, ContainerBuilder $container, Load
6262
{
6363
$loader->load('form-type.xml');
6464

65-
if (array_key_exists('dynamic', $config)) {
65+
if (\array_key_exists('dynamic', $config)) {
6666
$routeTypeTypeDefinition = $container->getDefinition('cmf_routing.route_type_form_type');
6767

6868
foreach (array_keys($config['dynamic']['controllers_by_type']) as $routeType) {
@@ -94,7 +94,7 @@ private function setupDynamicRouter(array $config, ContainerBuilder $container,
9494
$container->setParameter('cmf_routing.default_controller', $defaultController);
9595

9696
$locales = $config['locales'];
97-
if (0 === count($locales) && $config['auto_locale_pattern']) {
97+
if (0 === \count($locales) && $config['auto_locale_pattern']) {
9898
throw new InvalidConfigurationException('It makes no sense to activate auto_locale_pattern when no locales are configured.');
9999
}
100100

@@ -148,17 +148,17 @@ private function setupDynamicRouter(array $config, ContainerBuilder $container,
148148
$dynamic = $container->getDefinition('cmf_routing.dynamic_router');
149149

150150
// if any mappings are defined, set the respective route enhancer
151-
if (count($config['controllers_by_type']) > 0) {
151+
if (\count($config['controllers_by_type']) > 0) {
152152
$container->getDefinition('cmf_routing.enhancer.controllers_by_type')
153153
->addTag('dynamic_router_route_enhancer', ['priority' => 60]);
154154
}
155155

156-
if (count($config['controllers_by_class']) > 0) {
156+
if (\count($config['controllers_by_class']) > 0) {
157157
$container->getDefinition('cmf_routing.enhancer.controllers_by_class')
158158
->addTag('dynamic_router_route_enhancer', ['priority' => 50]);
159159
}
160160

161-
if (count($config['templates_by_class']) > 0) {
161+
if (\count($config['templates_by_class']) > 0) {
162162
$container->getDefinition('cmf_routing.enhancer.templates_by_class')
163163
->addTag('dynamic_router_route_enhancer', ['priority' => 40]);
164164

@@ -197,7 +197,7 @@ private function setupDynamicRouter(array $config, ContainerBuilder $container,
197197
->addTag('dynamic_router_route_enhancer', ['priority' => -100]);
198198
}
199199

200-
if (count($config['route_filters_by_id']) > 0) {
200+
if (\count($config['route_filters_by_id']) > 0) {
201201
$matcher = $container->getDefinition('cmf_routing.nested_matcher');
202202

203203
foreach ($config['route_filters_by_id'] as $id => $priority) {
@@ -217,7 +217,7 @@ private function loadPhpcrProvider(array $config, LoaderInterface $loader, Conta
217217

218218
$container->setParameter('cmf_routing.dynamic.persistence.phpcr.manager_name', $config['manager_name']);
219219

220-
if (0 === count($locales)) {
220+
if (0 === \count($locales)) {
221221
$container->removeDefinition('cmf_routing.phpcrodm_route_locale_listener');
222222
} elseif (!$matchImplicitLocale) {
223223
// remove all but the prefixes configuration from the service definition.

src/DependencyInjection/Configuration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ private function addDynamicSection(ArrayNodeDefinition $root)
9999
->addDefaultsIfNotSet()
100100
->validate()
101101
->ifTrue(function ($v) {
102-
return count(array_filter($v, function ($persistence) {
102+
return \count(array_filter($v, function ($persistence) {
103103
return $persistence['enabled'];
104104
})) > 1;
105105
})

src/Doctrine/DoctrineProvider.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ abstract class DoctrineProvider
5151
protected $routeCollectionLimit;
5252

5353
/**
54-
* @param ManagerRegistry $managerRegistry
55-
* @param string $className
54+
* @param string $className
5655
*/
5756
public function __construct(ManagerRegistry $managerRegistry, $className = null)
5857
{

src/Doctrine/Orm/ContentRepository.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,15 @@ public function findById($id)
5555
*/
5656
public function getContentId($content)
5757
{
58-
if (!is_object($content)) {
58+
if (!\is_object($content)) {
5959
return;
6060
}
6161

6262
try {
63-
$class = get_class($content);
63+
$class = \get_class($content);
6464
$meta = $this->getObjectManager()->getClassMetadata($class);
6565
$ids = $meta->getIdentifierValues($content);
66-
if (1 !== count($ids)) {
66+
if (1 !== \count($ids)) {
6767
throw new \Exception(sprintf('Class "%s" must use only one identifier', $class));
6868
}
6969

src/Doctrine/Orm/RedirectRoute.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ class RedirectRoute extends RedirectRouteModel
3838
* Additional options:
3939
*
4040
* * add_trailing_slash: When set, a trailing slash is appended to the route
41-
*
42-
* @param array $options
4341
*/
4442
public function __construct(array $options = [])
4543
{
@@ -74,7 +72,7 @@ public function getParameters()
7472
{
7573
$params = json_decode($this->serialisedParameters);
7674

77-
return is_array($params) ? $params : [];
75+
return \is_array($params) ? $params : [];
7876
}
7977

8078
/**
@@ -83,7 +81,7 @@ public function getParameters()
8381
public function getPath()
8482
{
8583
$pattern = parent::getPath();
86-
if ($this->getOption('add_trailing_slash') && '/' !== $pattern[strlen($pattern) - 1]) {
84+
if ($this->getOption('add_trailing_slash') && '/' !== $pattern[\strlen($pattern) - 1]) {
8785
$pattern .= '/';
8886
}
8987

src/Doctrine/Orm/RouteProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function getRouteCollectionForRequest(Request $request)
5151
$collection = new RouteCollection();
5252

5353
$candidates = $this->candidatesStrategy->getCandidates($request);
54-
if (0 === count($candidates)) {
54+
if (0 === \count($candidates)) {
5555
return $collection;
5656
}
5757
$routes = $this->getRouteRepository()->findByStaticPrefix($candidates, ['position' => 'ASC']);

src/Doctrine/Phpcr/ContentRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function findById($id)
3838
*/
3939
public function getContentId($content)
4040
{
41-
if (!is_object($content)) {
41+
if (!\is_object($content)) {
4242
return;
4343
}
4444

0 commit comments

Comments
 (0)