Skip to content

Commit c4fb14a

Browse files
Merge branch '4.3' into 4.4
* 4.3: Fix travis script minor fix for wrong case [HttpFoundation] Fix `getMaxFilesize` [Cache] fix warning on PHP 7.4 [Console] fix warning on PHP 7.4 Don't add value of (default/static) objects to the signature fix(yml): fix comment in milti line value Make sure trace_level is always defined Fix bindings and tagged_locator Recompile container when translations directory changes
2 parents 77ce7e0 + 120fe36 commit c4fb14a

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

Parser.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,9 @@ private function doParse(string $value, int $flags)
386386
$value = '';
387387

388388
foreach ($this->lines as $line) {
389+
if ('' !== ltrim($line) && '#' === ltrim($line)[0]) {
390+
continue;
391+
}
389392
// If the indentation is not consistent at offset 0, it is to be considered as a ParseError
390393
if (0 === $this->offset && !$deprecatedUsage && isset($line[0]) && ' ' === $line[0]) {
391394
throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename);

Tests/ParserTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2152,6 +2152,18 @@ public function indentedMappingData()
21522152

21532153
return $tests;
21542154
}
2155+
2156+
public function testMultiLineComment()
2157+
{
2158+
$yaml = <<<YAML
2159+
parameters:
2160+
abc
2161+
2162+
# Comment
2163+
YAML;
2164+
2165+
$this->assertSame(['parameters' => 'abc'], $this->parser->parse($yaml));
2166+
}
21552167
}
21562168

21572169
class B

0 commit comments

Comments
 (0)