Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 001de1b

Browse filesBrowse files
committed
Avoid an extra loop
1 parent 36474f8 commit 001de1b
Copy full SHA for 001de1b

File tree

1 file changed

+4
-9
lines changed
Filter options

1 file changed

+4
-9
lines changed

‎src/Symfony/Component/Yaml/Parser.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Yaml/Parser.php
+4-9Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -422,20 +422,15 @@ private function doParse($value, $flags)
422422

423423
// try to parse the value as a multi-line string as a last resort
424424
if (0 === $this->currentLineNb && 1 < $this->totalNumberOfLines) {
425-
// If the indentation is not consistent at offset 0, it is to be considered as a ParseError
426-
if (0 === $this->offset && !$deprecatedUsage) {
427-
foreach ($this->lines as $line) {
428-
if (rtrim($line) !== trim($line)) {
429-
throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename);
430-
}
431-
}
432-
}
433-
434425
$previousLineWasNewline = false;
435426
$previousLineWasTerminatedWithBackslash = false;
436427
$value = '';
437428

438429
foreach ($this->lines as $line) {
430+
// If the indentation is not consistent at offset 0, it is to be considered as a ParseError
431+
if (0 === $this->offset && !$deprecatedUsage && rtrim($line) !== trim($line)) {
432+
throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename);
433+
}
439434
if ('' === trim($line)) {
440435
$value .= "\n";
441436
} elseif (!$previousLineWasNewline && !$previousLineWasTerminatedWithBackslash) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.