Skip to content

Commit 3e90138

Browse files
SpacePossumnicolas-grekas
authored andcommitted
[CS][2.7] yoda_style, no_unneeded_curly_braces, no_unneeded_final_method, semicolon_after_instruction
1 parent 5bf241a commit 3e90138

File tree

137 files changed

+313
-310
lines changed

Some content is hidden

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

137 files changed

+313
-310
lines changed

.php_cs.dist

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,14 @@ return PhpCsFixer\Config::create()
99
'@Symfony' => true,
1010
'@Symfony:risky' => true,
1111
'array_syntax' => array('syntax' => 'long'),
12+
'no_break_comment' => false,
13+
'protected_to_private' => false,
1214
))
1315
->setRiskyAllowed(true)
1416
->setFinder(
1517
PhpCsFixer\Finder::create()
1618
->in(__DIR__.'/src')
19+
->append(array(__FILE__))
1720
->exclude(array(
1821
// directories containing files with content that is autogenerated by `var_export`, which breaks CS in output code
1922
'Symfony/Component/DependencyInjection/Tests/Fixtures',

src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,13 +199,13 @@ protected function registerMappingDrivers($objectManager, ContainerBuilder $cont
199199
if ($container->hasDefinition($mappingService)) {
200200
$mappingDriverDef = $container->getDefinition($mappingService);
201201
$args = $mappingDriverDef->getArguments();
202-
if ($driverType == 'annotation') {
202+
if ('annotation' == $driverType) {
203203
$args[1] = array_merge(array_values($driverPaths), $args[1]);
204204
} else {
205205
$args[0] = array_merge(array_values($driverPaths), $args[0]);
206206
}
207207
$mappingDriverDef->setArguments($args);
208-
} elseif ($driverType == 'annotation') {
208+
} elseif ('annotation' == $driverType) {
209209
$mappingDriverDef = new Definition('%'.$this->getObjectManagerElementName('metadata.'.$driverType.'.class%'), array(
210210
new Reference($this->getObjectManagerElementName('metadata.annotation_reader')),
211211
array_values($driverPaths),
@@ -333,7 +333,7 @@ protected function loadCacheDriver($cacheName, $objectManagerName, array $cacheD
333333
$memcacheClass = !empty($cacheDriver['class']) ? $cacheDriver['class'] : '%'.$this->getObjectManagerElementName('cache.memcache.class').'%';
334334
$memcacheInstanceClass = !empty($cacheDriver['instance_class']) ? $cacheDriver['instance_class'] : '%'.$this->getObjectManagerElementName('cache.memcache_instance.class').'%';
335335
$memcacheHost = !empty($cacheDriver['host']) ? $cacheDriver['host'] : '%'.$this->getObjectManagerElementName('cache.memcache_host').'%';
336-
$memcachePort = !empty($cacheDriver['port']) || (isset($cacheDriver['port']) && $cacheDriver['port'] === 0) ? $cacheDriver['port'] : '%'.$this->getObjectManagerElementName('cache.memcache_port').'%';
336+
$memcachePort = !empty($cacheDriver['port']) || (isset($cacheDriver['port']) && 0 === $cacheDriver['port']) ? $cacheDriver['port'] : '%'.$this->getObjectManagerElementName('cache.memcache_port').'%';
337337
$cacheDef = new Definition($memcacheClass);
338338
$memcacheInstance = new Definition($memcacheInstanceClass);
339339
$memcacheInstance->addMethodCall('connect', array(

src/Symfony/Bridge/Doctrine/Form/ChoiceList/ORMQueryBuilderLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public function getEntitiesByIds($identifier, array $values)
111111

112112
// Like above, but we just filter out empty strings.
113113
$values = array_values(array_filter($values, function ($v) {
114-
return (string) $v !== '';
114+
return '' !== (string) $v;
115115
}));
116116
} else {
117117
$parameterType = Connection::PARAM_STR_ARRAY;

src/Symfony/Bridge/Doctrine/Form/EventListener/MergeDoctrineCollectionListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function onBind(FormEvent $event)
4141

4242
// If all items were removed, call clear which has a higher
4343
// performance on persistent collections
44-
if ($collection instanceof Collection && count($data) === 0) {
44+
if ($collection instanceof Collection && 0 === count($data)) {
4545
$collection->clear();
4646
}
4747
}

src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public function configureOptions(OptionsResolver $resolver)
176176
$entityLoader
177177
);
178178

179-
if ($hash !== null) {
179+
if (null !== $hash) {
180180
$choiceLoaders[$hash] = $doctrineChoiceLoader;
181181
}
182182

src/Symfony/Bridge/Twig/Command/DebugCommand.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
8888

8989
$types = array('functions', 'filters', 'tests', 'globals');
9090

91-
if ($input->getOption('format') === 'json') {
91+
if ('json' === $input->getOption('format')) {
9292
$data = array();
9393
foreach ($types as $type) {
9494
foreach ($twig->{'get'.ucfirst($type)}() as $name => $entity) {
@@ -129,13 +129,13 @@ protected function execute(InputInterface $input, OutputInterface $output)
129129

130130
private function getMetadata($type, $entity)
131131
{
132-
if ($type === 'globals') {
132+
if ('globals' === $type) {
133133
return $entity;
134134
}
135-
if ($type === 'tests') {
135+
if ('tests' === $type) {
136136
return;
137137
}
138-
if ($type === 'functions' || $type === 'filters') {
138+
if ('functions' === $type || 'filters' === $type) {
139139
$cb = $entity->getCallable();
140140
if (null === $cb) {
141141
return;
@@ -165,7 +165,7 @@ private function getMetadata($type, $entity)
165165
array_shift($args);
166166
}
167167

168-
if ($type === 'filters') {
168+
if ('filters' === $type) {
169169
// remove the value the filter is applied on
170170
array_shift($args);
171171
}
@@ -185,32 +185,32 @@ private function getMetadata($type, $entity)
185185

186186
private function getPrettyMetadata($type, $entity)
187187
{
188-
if ($type === 'tests') {
188+
if ('tests' === $type) {
189189
return '';
190190
}
191191

192192
try {
193193
$meta = $this->getMetadata($type, $entity);
194-
if ($meta === null) {
194+
if (null === $meta) {
195195
return '(unknown?)';
196196
}
197197
} catch (\UnexpectedValueException $e) {
198198
return ' <error>'.$e->getMessage().'</error>';
199199
}
200200

201-
if ($type === 'globals') {
201+
if ('globals' === $type) {
202202
if (is_object($meta)) {
203203
return ' = object('.get_class($meta).')';
204204
}
205205

206206
return ' = '.substr(@json_encode($meta), 0, 50);
207207
}
208208

209-
if ($type === 'functions') {
209+
if ('functions' === $type) {
210210
return '('.implode(', ', $meta).')';
211211
}
212212

213-
if ($type === 'filters') {
213+
if ('filters' === $type) {
214214
return $meta ? '('.implode(', ', $meta).')' : '';
215215
}
216216
}

src/Symfony/Bridge/Twig/Extension/StopwatchExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function getTokenParsers()
4848
* Some stuff which will be recorded on the timeline
4949
* {% endstopwatch %}
5050
*/
51-
new StopwatchTokenParser($this->stopwatch !== null && $this->enabled),
51+
new StopwatchTokenParser(null !== $this->stopwatch && $this->enabled),
5252
);
5353
}
5454

src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3HorizontalLayoutTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ protected function renderEnctype(FormView $view)
7575

7676
protected function renderLabel(FormView $view, $label = null, array $vars = array())
7777
{
78-
if ($label !== null) {
78+
if (null !== $label) {
7979
$vars += array('label' => $label);
8080
}
8181

src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3LayoutTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ protected function renderEnctype(FormView $view)
7575

7676
protected function renderLabel(FormView $view, $label = null, array $vars = array())
7777
{
78-
if ($label !== null) {
78+
if (null !== $label) {
7979
$vars += array('label' => $label);
8080
}
8181

src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ protected function renderEnctype(FormView $view)
158158

159159
protected function renderLabel(FormView $view, $label = null, array $vars = array())
160160
{
161-
if ($label !== null) {
161+
if (null !== $label) {
162162
$vars += array('label' => $label);
163163
}
164164

0 commit comments

Comments
 (0)