Skip to content

Commit d0fc816

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 1d8c2a9 + 40ca98b commit d0fc816

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

Command/LintCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ private function displayTxt(SymfonyStyle $io, array $filesInfo)
149149
}
150150
}
151151

152-
if ($erroredFiles === 0) {
152+
if (0 === $erroredFiles) {
153153
$io->success(sprintf('All %d YAML files contain valid syntax.', $countFiles));
154154
} else {
155155
$io->warning(sprintf('%d YAML files have valid syntax and %d contain errors.', $countFiles - $erroredFiles, $erroredFiles));

Inline.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ private static function evaluateScalar($scalar, $flags, $references = array())
606606
return true;
607607
case 'false' === $scalarLower:
608608
return false;
609-
case $scalar[0] === '!':
609+
case '!' === $scalar[0]:
610610
switch (true) {
611611
case 0 === strpos($scalar, '!str'):
612612
return (string) substr($scalar, 5);
@@ -656,7 +656,7 @@ private static function evaluateScalar($scalar, $flags, $references = array())
656656
}
657657

658658
// Optimize for returning strings.
659-
case $scalar[0] === '+' || $scalar[0] === '-' || $scalar[0] === '.' || is_numeric($scalar[0]):
659+
case '+' === $scalar[0] || '-' === $scalar[0] || '.' === $scalar[0] || is_numeric($scalar[0]):
660660
switch (true) {
661661
case Parser::preg_match('{^[+-]?[0-9][0-9_]*$}', $scalar):
662662
$scalar = str_replace('_', '', (string) $scalar);

Parser.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ private function doParse($value, $flags)
263263

264264
$data += $refValue; // array union
265265
} else {
266-
if (isset($values['value']) && $values['value'] !== '') {
266+
if (isset($values['value']) && '' !== $values['value']) {
267267
$value = $values['value'];
268268
} else {
269269
$value = $this->getNextEmbedBlock();
@@ -544,7 +544,7 @@ private function getNextEmbedBlock($indentation = null, $inSequence = false)
544544
$indent = $this->getCurrentLineIndentation();
545545

546546
// terminate all block scalars that are more indented than the current line
547-
if (!empty($blockScalarIndentations) && $indent < $previousLineIndentation && trim($this->currentLine) !== '') {
547+
if (!empty($blockScalarIndentations) && $indent < $previousLineIndentation && '' !== trim($this->currentLine)) {
548548
foreach ($blockScalarIndentations as $key => $blockScalarIndentation) {
549549
if ($blockScalarIndentation >= $indent) {
550550
unset($blockScalarIndentations[$key]);
@@ -680,7 +680,7 @@ private function parseValue($value, $flags, $context)
680680

681681
while ($this->moveToNextLine()) {
682682
// unquoted strings end before the first unindented line
683-
if (null === $quotation && $this->getCurrentLineIndentation() === 0) {
683+
if (null === $quotation && 0 === $this->getCurrentLineIndentation()) {
684684
$this->moveToPreviousLine();
685685

686686
break;
@@ -876,7 +876,7 @@ private function isCurrentLineComment()
876876
//checking explicitly the first char of the trim is faster than loops or strpos
877877
$ltrimmedLine = ltrim($this->currentLine, ' ');
878878

879-
return '' !== $ltrimmedLine && $ltrimmedLine[0] === '#';
879+
return '' !== $ltrimmedLine && '#' === $ltrimmedLine[0];
880880
}
881881

882882
private function isCurrentLineLastLineInDocument()
@@ -902,15 +902,15 @@ private function cleanup($value)
902902

903903
// remove leading comments
904904
$trimmedValue = preg_replace('#^(\#.*?\n)+#s', '', $value, -1, $count);
905-
if ($count == 1) {
905+
if (1 == $count) {
906906
// items have been removed, update the offset
907907
$this->offset += substr_count($value, "\n") - substr_count($trimmedValue, "\n");
908908
$value = $trimmedValue;
909909
}
910910

911911
// remove start of the document marker (---)
912912
$trimmedValue = preg_replace('#^\-\-\-.*?\n#s', '', $value, -1, $count);
913-
if ($count == 1) {
913+
if (1 == $count) {
914914
// items have been removed, update the offset
915915
$this->offset += substr_count($value, "\n") - substr_count($trimmedValue, "\n");
916916
$value = $trimmedValue;

0 commit comments

Comments
 (0)