Skip to content

Commit 870c996

Browse files
Merge branch '3.3' into 3.4
* 3.3: [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. Removed unnecessary getDefinition() call. .php_cs.dist - simplify config [WebProfilerBundle] fixed TemplateManager when using Twig 2 without compat interfaces
2 parents c076a2d + d0fc816 commit 870c996

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
@@ -150,7 +150,7 @@ private function displayTxt(SymfonyStyle $io, array $filesInfo)
150150
}
151151
}
152152

153-
if ($erroredFiles === 0) {
153+
if (0 === $erroredFiles) {
154154
$io->success(sprintf('All %d YAML files contain valid syntax.', $countFiles));
155155
} else {
156156
$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
@@ -619,7 +619,7 @@ private static function evaluateScalar($scalar, $flags, $references = array())
619619
return true;
620620
case 'false' === $scalarLower:
621621
return false;
622-
case $scalar[0] === '!':
622+
case '!' === $scalar[0]:
623623
switch (true) {
624624
case 0 === strpos($scalar, '!str'):
625625
@trigger_error('Support for the !str tag is deprecated since version 3.4. Use the !!str tag instead.', E_USER_DEPRECATED);
@@ -702,7 +702,7 @@ private static function evaluateScalar($scalar, $flags, $references = array())
702702
}
703703

704704
// Optimize for returning strings.
705-
case $scalar[0] === '+' || $scalar[0] === '-' || $scalar[0] === '.' || is_numeric($scalar[0]):
705+
case '+' === $scalar[0] || '-' === $scalar[0] || '.' === $scalar[0] || is_numeric($scalar[0]):
706706
switch (true) {
707707
case Parser::preg_match('{^[+-]?[0-9][0-9_]*$}', $scalar):
708708
$scalar = str_replace('_', '', (string) $scalar);

Parser.php

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

268268
$data += $refValue; // array union
269269
} else {
270-
if (isset($values['value']) && $values['value'] !== '') {
270+
if (isset($values['value']) && '' !== $values['value']) {
271271
$value = $values['value'];
272272
} else {
273273
$value = $this->getNextEmbedBlock();
@@ -550,7 +550,7 @@ private function getNextEmbedBlock($indentation = null, $inSequence = false)
550550
$indent = $this->getCurrentLineIndentation();
551551

552552
// terminate all block scalars that are more indented than the current line
553-
if (!empty($blockScalarIndentations) && $indent < $previousLineIndentation && trim($this->currentLine) !== '') {
553+
if (!empty($blockScalarIndentations) && $indent < $previousLineIndentation && '' !== trim($this->currentLine)) {
554554
foreach ($blockScalarIndentations as $key => $blockScalarIndentation) {
555555
if ($blockScalarIndentation >= $indent) {
556556
unset($blockScalarIndentations[$key]);
@@ -686,7 +686,7 @@ private function parseValue($value, $flags, $context)
686686

687687
while ($this->moveToNextLine()) {
688688
// unquoted strings end before the first unindented line
689-
if (null === $quotation && $this->getCurrentLineIndentation() === 0) {
689+
if (null === $quotation && 0 === $this->getCurrentLineIndentation()) {
690690
$this->moveToPreviousLine();
691691

692692
break;
@@ -882,7 +882,7 @@ private function isCurrentLineComment()
882882
//checking explicitly the first char of the trim is faster than loops or strpos
883883
$ltrimmedLine = ltrim($this->currentLine, ' ');
884884

885-
return '' !== $ltrimmedLine && $ltrimmedLine[0] === '#';
885+
return '' !== $ltrimmedLine && '#' === $ltrimmedLine[0];
886886
}
887887

888888
private function isCurrentLineLastLineInDocument()
@@ -908,15 +908,15 @@ private function cleanup($value)
908908

909909
// remove leading comments
910910
$trimmedValue = preg_replace('#^(\#.*?\n)+#s', '', $value, -1, $count);
911-
if ($count == 1) {
911+
if (1 == $count) {
912912
// items have been removed, update the offset
913913
$this->offset += substr_count($value, "\n") - substr_count($trimmedValue, "\n");
914914
$value = $trimmedValue;
915915
}
916916

917917
// remove start of the document marker (---)
918918
$trimmedValue = preg_replace('#^\-\-\-.*?\n#s', '', $value, -1, $count);
919-
if ($count == 1) {
919+
if (1 == $count) {
920920
// items have been removed, update the offset
921921
$this->offset += substr_count($value, "\n") - substr_count($trimmedValue, "\n");
922922
$value = $trimmedValue;

0 commit comments

Comments
 (0)