Skip to content

Commit 4cffdcf

Browse files
SpacePossumnicolas-grekas
authored andcommitted
[CS][2.7] yoda_style, no_unneeded_curly_braces, no_unneeded_final_method, semicolon_after_instruction
1 parent dee17ff commit 4cffdcf

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

Inline.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ private static function evaluateScalar($scalar, $references = array())
481481
case 'false' === $scalarLower:
482482
return false;
483483
// Optimise for returning strings.
484-
case $scalar[0] === '+' || $scalar[0] === '-' || $scalar[0] === '.' || $scalar[0] === '!' || is_numeric($scalar[0]):
484+
case '+' === $scalar[0] || '-' === $scalar[0] || '.' === $scalar[0] || '!' === $scalar[0] || is_numeric($scalar[0]):
485485
switch (true) {
486486
case 0 === strpos($scalar, '!str'):
487487
return (string) substr($scalar, 5);

Parser.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ private function doParse($value, $exceptionOnInvalidType = false, $objectSupport
200200

201201
$data += $refValue; // array union
202202
} else {
203-
if (isset($values['value']) && $values['value'] !== '') {
203+
if (isset($values['value']) && '' !== $values['value']) {
204204
$value = $values['value'];
205205
} else {
206206
$value = $this->getNextEmbedBlock();
@@ -406,7 +406,7 @@ private function getNextEmbedBlock($indentation = null, $inSequence = false)
406406
$indent = $this->getCurrentLineIndentation();
407407

408408
// terminate all block scalars that are more indented than the current line
409-
if (!empty($blockScalarIndentations) && $indent < $previousLineIndentation && trim($this->currentLine) !== '') {
409+
if (!empty($blockScalarIndentations) && $indent < $previousLineIndentation && '' !== trim($this->currentLine)) {
410410
foreach ($blockScalarIndentations as $key => $blockScalarIndentation) {
411411
if ($blockScalarIndentation >= $this->getCurrentLineIndentation()) {
412412
unset($blockScalarIndentations[$key]);
@@ -699,7 +699,7 @@ private function isCurrentLineComment()
699699
//checking explicitly the first char of the trim is faster than loops or strpos
700700
$ltrimmedLine = ltrim($this->currentLine, ' ');
701701

702-
return '' !== $ltrimmedLine && $ltrimmedLine[0] === '#';
702+
return '' !== $ltrimmedLine && '#' === $ltrimmedLine[0];
703703
}
704704

705705
private function isCurrentLineLastLineInDocument()
@@ -725,15 +725,15 @@ private function cleanup($value)
725725

726726
// remove leading comments
727727
$trimmedValue = preg_replace('#^(\#.*?\n)+#s', '', $value, -1, $count);
728-
if ($count == 1) {
728+
if (1 == $count) {
729729
// items have been removed, update the offset
730730
$this->offset += substr_count($value, "\n") - substr_count($trimmedValue, "\n");
731731
$value = $trimmedValue;
732732
}
733733

734734
// remove start of the document marker (---)
735735
$trimmedValue = preg_replace('#^\-\-\-.*?\n#s', '', $value, -1, $count);
736-
if ($count == 1) {
736+
if (1 == $count) {
737737
// items have been removed, update the offset
738738
$this->offset += substr_count($value, "\n") - substr_count($trimmedValue, "\n");
739739
$value = $trimmedValue;

Yaml.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public static function parse($input, $exceptionOnInvalidType = false, $objectSup
4848
{
4949
// if input is a file, process it
5050
$file = '';
51-
if (strpos($input, "\n") === false && is_file($input)) {
51+
if (false === strpos($input, "\n") && is_file($input)) {
5252
@trigger_error('The ability to pass file names to the '.__METHOD__.' method is deprecated since version 2.2 and will be removed in 3.0. Pass the YAML contents of the file instead.', E_USER_DEPRECATED);
5353

5454
if (false === is_readable($input)) {

0 commit comments

Comments
 (0)