Skip to content

Commit 40ca98b

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 4c29dec + 4cffdcf commit 40ca98b

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
@@ -491,7 +491,7 @@ private static function evaluateScalar($scalar, $references = array())
491491
case 'false' === $scalarLower:
492492
return false;
493493
// Optimise for returning strings.
494-
case $scalar[0] === '+' || $scalar[0] === '-' || $scalar[0] === '.' || $scalar[0] === '!' || is_numeric($scalar[0]):
494+
case '+' === $scalar[0] || '-' === $scalar[0] || '.' === $scalar[0] || '!' === $scalar[0] || is_numeric($scalar[0]):
495495
switch (true) {
496496
case 0 === strpos($scalar, '!str'):
497497
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();
@@ -412,7 +412,7 @@ private function getNextEmbedBlock($indentation = null, $inSequence = false)
412412
$indent = $this->getCurrentLineIndentation();
413413

414414
// terminate all block scalars that are more indented than the current line
415-
if (!empty($blockScalarIndentations) && $indent < $previousLineIndentation && trim($this->currentLine) !== '') {
415+
if (!empty($blockScalarIndentations) && $indent < $previousLineIndentation && '' !== trim($this->currentLine)) {
416416
foreach ($blockScalarIndentations as $key => $blockScalarIndentation) {
417417
if ($blockScalarIndentation >= $this->getCurrentLineIndentation()) {
418418
unset($blockScalarIndentations[$key]);
@@ -715,7 +715,7 @@ private function isCurrentLineComment()
715715
//checking explicitly the first char of the trim is faster than loops or strpos
716716
$ltrimmedLine = ltrim($this->currentLine, ' ');
717717

718-
return '' !== $ltrimmedLine && $ltrimmedLine[0] === '#';
718+
return '' !== $ltrimmedLine && '#' === $ltrimmedLine[0];
719719
}
720720

721721
private function isCurrentLineLastLineInDocument()
@@ -741,15 +741,15 @@ private function cleanup($value)
741741

742742
// remove leading comments
743743
$trimmedValue = preg_replace('#^(\#.*?\n)+#s', '', $value, -1, $count);
744-
if ($count == 1) {
744+
if (1 == $count) {
745745
// items have been removed, update the offset
746746
$this->offset += substr_count($value, "\n") - substr_count($trimmedValue, "\n");
747747
$value = $trimmedValue;
748748
}
749749

750750
// remove start of the document marker (---)
751751
$trimmedValue = preg_replace('#^\-\-\-.*?\n#s', '', $value, -1, $count);
752-
if ($count == 1) {
752+
if (1 == $count) {
753753
// items have been removed, update the offset
754754
$this->offset += substr_count($value, "\n") - substr_count($trimmedValue, "\n");
755755
$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)