Skip to content

Commit c1d8833

Browse files
Merge branch '3.4'
* 3.4: [CS][2.7] yoda_style, no_unneeded_curly_braces, no_unneeded_final_method, semicolon_after_instruction Reset stopwatch. [Filesystem] mirror - fix copying content with same name as source/target. Removed unnecessary getDefinition() call. .php_cs.dist - simplify config [WebProfilerBundle] fixed TemplateManager when using Twig 2 without compat interfaces
2 parents bc39ab5 + 4b31b47 commit c1d8833

File tree

137 files changed

+314
-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.

137 files changed

+314
-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->setPrivate(true);

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
@@ -45,7 +45,7 @@ public function onSubmit(FormEvent $event)
4545

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

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
@@ -73,7 +73,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
7373
$io = new SymfonyStyle($input, $output);
7474
$types = array('functions', 'filters', 'tests', 'globals');
7575

76-
if ($input->getOption('format') === 'json') {
76+
if ('json' === $input->getOption('format')) {
7777
$data = array();
7878
foreach ($types as $type) {
7979
foreach ($this->twig->{'get'.ucfirst($type)}() as $name => $entity) {
@@ -157,13 +157,13 @@ private function getLoaderPaths()
157157

158158
private function getMetadata($type, $entity)
159159
{
160-
if ($type === 'globals') {
160+
if ('globals' === $type) {
161161
return $entity;
162162
}
163-
if ($type === 'tests') {
163+
if ('tests' === $type) {
164164
return;
165165
}
166-
if ($type === 'functions' || $type === 'filters') {
166+
if ('functions' === $type || 'filters' === $type) {
167167
$cb = $entity->getCallable();
168168
if (null === $cb) {
169169
return;
@@ -193,7 +193,7 @@ private function getMetadata($type, $entity)
193193
array_shift($args);
194194
}
195195

196-
if ($type === 'filters') {
196+
if ('filters' === $type) {
197197
// remove the value the filter is applied on
198198
array_shift($args);
199199
}
@@ -213,32 +213,32 @@ private function getMetadata($type, $entity)
213213

214214
private function getPrettyMetadata($type, $entity)
215215
{
216-
if ($type === 'tests') {
216+
if ('tests' === $type) {
217217
return '';
218218
}
219219

220220
try {
221221
$meta = $this->getMetadata($type, $entity);
222-
if ($meta === null) {
222+
if (null === $meta) {
223223
return '(unknown?)';
224224
}
225225
} catch (\UnexpectedValueException $e) {
226226
return ' <error>'.$e->getMessage().'</error>';
227227
}
228228

229-
if ($type === 'globals') {
229+
if ('globals' === $type) {
230230
if (is_object($meta)) {
231231
return ' = object('.get_class($meta).')';
232232
}
233233

234234
return ' = '.substr(@json_encode($meta), 0, 50);
235235
}
236236

237-
if ($type === 'functions') {
237+
if ('functions' === $type) {
238238
return '('.implode(', ', $meta).')';
239239
}
240240

241-
if ($type === 'filters') {
241+
if ('filters' === $type) {
242242
return $meta ? '('.implode(', ', $meta).')' : '';
243243
}
244244
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ private function displayTxt(OutputInterface $output, SymfonyStyle $io, $filesInf
159159
}
160160
}
161161

162-
if ($errors === 0) {
162+
if (0 === $errors) {
163163
$io->success(sprintf('All %d Twig files contain valid syntax.', count($filesInfo)));
164164
} else {
165165
$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
@@ -62,7 +62,7 @@ protected function renderForm(FormView $view, array $vars = array())
6262

6363
protected function renderLabel(FormView $view, $label = null, array $vars = array())
6464
{
65-
if ($label !== null) {
65+
if (null !== $label) {
6666
$vars += array('label' => $label);
6767
}
6868

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

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

8383
protected function renderLabel(FormView $view, $label = null, array $vars = array())
8484
{
85-
if ($label !== null) {
85+
if (null !== $label) {
8686
$vars += array('label' => $label);
8787
}
8888

0 commit comments

Comments
 (0)