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 1213324

Browse filesBrowse files
soufianZantarxabbuh
authored andcommitted
fix(yml): fix comment in milti line value
1 parent aefc7f5 commit 1213324
Copy full SHA for 1213324

File tree

2 files changed

+15
-0
lines changed
Filter options

2 files changed

+15
-0
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Yaml/Parser.php
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,9 @@ private function doParse($value, $flags)
436436
$value = '';
437437

438438
foreach ($this->lines as $line) {
439+
if ('' !== $line && '#' === ltrim($line)[0]) {
440+
continue;
441+
}
439442
// If the indentation is not consistent at offset 0, it is to be considered as a ParseError
440443
if (0 === $this->offset && !$deprecatedUsage && isset($line[0]) && ' ' === $line[0]) {
441444
throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename);

‎src/Symfony/Component/Yaml/Tests/ParserTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Yaml/Tests/ParserTest.php
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2292,6 +2292,18 @@ public function indentedMappingData()
22922292

22932293
return $tests;
22942294
}
2295+
2296+
public function testMultiLineComment()
2297+
{
2298+
$yaml = <<<YAML
2299+
parameters:
2300+
abc
2301+
2302+
# Comment
2303+
YAML;
2304+
2305+
$this->assertSame(['parameters' => 'abc'], $this->parser->parse($yaml));
2306+
}
22952307
}
22962308

22972309
class B

0 commit comments

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