Skip to content

Commit c82ca6d

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 784374e + 2fc9fcd commit c82ca6d

7 files changed

+16
-16
lines changed

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
}

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));

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

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

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

Tests/Extension/FormExtensionDivLayoutTest.php

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

183183
protected function renderLabel(FormView $view, $label = null, array $vars = array())
184184
{
185-
if ($label !== null) {
185+
if (null !== $label) {
186186
$vars += array('label' => $label);
187187
}
188188

Tests/Extension/FormExtensionTableLayoutTest.php

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

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

0 commit comments

Comments
 (0)