Skip to content

Commit ebbcb7b

Browse files
Merge branch '2.8' into 3.3
* 2.8: [CS][2.7] yoda_style, no_unneeded_curly_braces, no_unneeded_final_method, semicolon_after_instruction [Filesystem] mirror - fix copying content with same name as source/target. .php_cs.dist - simplify config [WebProfilerBundle] fixed TemplateManager when using Twig 2 without compat interfaces
2 parents 0256e59 + 6f92475 commit ebbcb7b

File tree

136 files changed

+313
-265
lines changed

Some content is hidden

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

136 files changed

+313
-265
lines changed

.php_cs.dist

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,14 @@ return PhpCsFixer\Config::create()
99
'@Symfony' => true,
1010
'@Symfony:risky' => true,
1111
'array_syntax' => array('syntax' => 'long'),
12-
'no_unreachable_default_argument_value' => false,
13-
'braces' => array('allow_single_line_closure' => true),
14-
'heredoc_to_nowdoc' => false,
12+
'no_break_comment' => false,
1513
'protected_to_private' => false,
1614
))
1715
->setRiskyAllowed(true)
1816
->setFinder(
1917
PhpCsFixer\Finder::create()
2018
->in(__DIR__.'/src')
19+
->append(array(__FILE__))
2120
->exclude(array(
2221
// directories containing files with content that is autogenerated by `var_export`, which breaks CS in output code
2322
'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
@@ -198,13 +198,13 @@ protected function registerMappingDrivers($objectManager, ContainerBuilder $cont
198198
if ($container->hasDefinition($mappingService)) {
199199
$mappingDriverDef = $container->getDefinition($mappingService);
200200
$args = $mappingDriverDef->getArguments();
201-
if ($driverType == 'annotation') {
201+
if ('annotation' == $driverType) {
202202
$args[1] = array_merge(array_values($driverPaths), $args[1]);
203203
} else {
204204
$args[0] = array_merge(array_values($driverPaths), $args[0]);
205205
}
206206
$mappingDriverDef->setArguments($args);
207-
} elseif ($driverType == 'annotation') {
207+
} elseif ('annotation' == $driverType) {
208208
$mappingDriverDef = new Definition('%'.$this->getObjectManagerElementName('metadata.'.$driverType.'.class%'), array(
209209
new Reference($this->getObjectManagerElementName('metadata.annotation_reader')),
210210
array_values($driverPaths),
@@ -330,7 +330,7 @@ protected function loadCacheDriver($cacheName, $objectManagerName, array $cacheD
330330
$memcacheClass = !empty($cacheDriver['class']) ? $cacheDriver['class'] : '%'.$this->getObjectManagerElementName('cache.memcache.class').'%';
331331
$memcacheInstanceClass = !empty($cacheDriver['instance_class']) ? $cacheDriver['instance_class'] : '%'.$this->getObjectManagerElementName('cache.memcache_instance.class').'%';
332332
$memcacheHost = !empty($cacheDriver['host']) ? $cacheDriver['host'] : '%'.$this->getObjectManagerElementName('cache.memcache_host').'%';
333-
$memcachePort = !empty($cacheDriver['port']) || (isset($cacheDriver['port']) && $cacheDriver['port'] === 0) ? $cacheDriver['port'] : '%'.$this->getObjectManagerElementName('cache.memcache_port').'%';
333+
$memcachePort = !empty($cacheDriver['port']) || (isset($cacheDriver['port']) && 0 === $cacheDriver['port']) ? $cacheDriver['port'] : '%'.$this->getObjectManagerElementName('cache.memcache_port').'%';
334334
$cacheDef = new Definition($memcacheClass);
335335
$memcacheInstance = new Definition($memcacheInstanceClass);
336336
$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
@@ -77,7 +77,7 @@ public function getEntitiesByIds($identifier, array $values)
7777

7878
// Like above, but we just filter out empty strings.
7979
$values = array_values(array_filter($values, function ($v) {
80-
return (string) $v !== '';
80+
return '' !== (string) $v;
8181
}));
8282
} else {
8383
$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
@@ -60,7 +60,7 @@ public function onSubmit(FormEvent $event)
6060

6161
// If all items were removed, call clear which has a higher
6262
// performance on persistent collections
63-
if ($collection instanceof Collection && count($data) === 0) {
63+
if ($collection instanceof Collection && 0 === count($data)) {
6464
$collection->clear();
6565
}
6666
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public function configureOptions(OptionsResolver $resolver)
151151
$entityLoader
152152
);
153153

154-
if ($hash !== null) {
154+
if (null !== $hash) {
155155
$this->choiceLoaders[$hash] = $doctrineChoiceLoader;
156156
}
157157

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) {
@@ -126,13 +126,13 @@ protected function execute(InputInterface $input, OutputInterface $output)
126126

127127
private function getMetadata($type, $entity)
128128
{
129-
if ($type === 'globals') {
129+
if ('globals' === $type) {
130130
return $entity;
131131
}
132-
if ($type === 'tests') {
132+
if ('tests' === $type) {
133133
return;
134134
}
135-
if ($type === 'functions' || $type === 'filters') {
135+
if ('functions' === $type || 'filters' === $type) {
136136
$cb = $entity->getCallable();
137137
if (null === $cb) {
138138
return;
@@ -162,7 +162,7 @@ private function getMetadata($type, $entity)
162162
array_shift($args);
163163
}
164164

165-
if ($type === 'filters') {
165+
if ('filters' === $type) {
166166
// remove the value the filter is applied on
167167
array_shift($args);
168168
}
@@ -182,32 +182,32 @@ private function getMetadata($type, $entity)
182182

183183
private function getPrettyMetadata($type, $entity)
184184
{
185-
if ($type === 'tests') {
185+
if ('tests' === $type) {
186186
return '';
187187
}
188188

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

198-
if ($type === 'globals') {
198+
if ('globals' === $type) {
199199
if (is_object($meta)) {
200200
return ' = object('.get_class($meta).')';
201201
}
202202

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

206-
if ($type === 'functions') {
206+
if ('functions' === $type) {
207207
return '('.implode(', ', $meta).')';
208208
}
209209

210-
if ($type === 'filters') {
210+
if ('filters' === $type) {
211211
return $meta ? '('.implode(', ', $meta).')' : '';
212212
}
213213
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ private function displayTxt(OutputInterface $output, SymfonyStyle $io, $filesInf
176176
}
177177
}
178178

179-
if ($errors === 0) {
179+
if (0 === $errors) {
180180
$io->success(sprintf('All %d Twig files contain valid syntax.', count($filesInfo)));
181181
} else {
182182
$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
@@ -59,7 +59,7 @@ protected function renderForm(FormView $view, array $vars = array())
5959

6060
protected function renderLabel(FormView $view, $label = null, array $vars = array())
6161
{
62-
if ($label !== null) {
62+
if (null !== $label) {
6363
$vars += array('label' => $label);
6464
}
6565

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ protected function renderForm(FormView $view, array $vars = array())
7979

8080
protected function renderLabel(FormView $view, $label = null, array $vars = array())
8181
{
82-
if ($label !== null) {
82+
if (null !== $label) {
8383
$vars += array('label' => $label);
8484
}
8585

0 commit comments

Comments
 (0)