Skip to content

Commit 6f92475

Browse files
Merge branch '2.7' into 2.8
* 2.7: [CS][2.7] yoda_style, no_unneeded_curly_braces, no_unneeded_final_method, semicolon_after_instruction
2 parents 1e4d4ef + 800f306 commit 6f92475

File tree

142 files changed

+314
-311
lines changed

Some content is hidden

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

142 files changed

+314
-311
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
@@ -90,7 +90,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
9090

9191
$types = array('functions', 'filters', 'tests', 'globals');
9292

93-
if ($input->getOption('format') === 'json') {
93+
if ('json' === $input->getOption('format')) {
9494
$data = array();
9595
foreach ($types as $type) {
9696
foreach ($twig->{'get'.ucfirst($type)}() as $name => $entity) {
@@ -128,13 +128,13 @@ protected function execute(InputInterface $input, OutputInterface $output)
128128

129129
private function getMetadata($type, $entity)
130130
{
131-
if ($type === 'globals') {
131+
if ('globals' === $type) {
132132
return $entity;
133133
}
134-
if ($type === 'tests') {
134+
if ('tests' === $type) {
135135
return;
136136
}
137-
if ($type === 'functions' || $type === 'filters') {
137+
if ('functions' === $type || 'filters' === $type) {
138138
$cb = $entity->getCallable();
139139
if (null === $cb) {
140140
return;
@@ -164,7 +164,7 @@ private function getMetadata($type, $entity)
164164
array_shift($args);
165165
}
166166

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

185185
private function getPrettyMetadata($type, $entity)
186186
{
187-
if ($type === 'tests') {
187+
if ('tests' === $type) {
188188
return '';
189189
}
190190

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

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

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

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

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

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ private function displayTxt(OutputInterface $output, SymfonyStyle $io, $filesInf
183183
}
184184
}
185185

186-
if ($errors === 0) {
186+
if (0 === $errors) {
187187
$io->success(sprintf('All %d Twig files contain valid syntax.', count($filesInfo)));
188188
} else {
189189
$io->warning(sprintf('%d Twig files have valid syntax and %d contain errors.', count($filesInfo) - $errors, $errors));

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
@@ -99,7 +99,7 @@ protected function renderEnctype(FormView $view)
9999

100100
protected function renderLabel(FormView $view, $label = null, array $vars = array())
101101
{
102-
if ($label !== null) {
102+
if (null !== $label) {
103103
$vars += array('label' => $label);
104104
}
105105

0 commit comments

Comments
 (0)