fix(yml): fix comment in milti line value

This commit is contained in:
Soufian EZ ZANTAR 2019-07-27 00:20:27 +02:00 committed by soufianZantar
parent aefc7f54d7
commit dd945e375c
2 changed files with 15 additions and 0 deletions

View File

@ -436,6 +436,9 @@ class Parser
$value = '';
foreach ($this->lines as $line) {
if ('' !== ltrim($line) && '#' === ltrim($line)[0]) {
continue;
}
// If the indentation is not consistent at offset 0, it is to be considered as a ParseError
if (0 === $this->offset && !$deprecatedUsage && isset($line[0]) && ' ' === $line[0]) {
throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename);

View File

@ -2292,6 +2292,18 @@ YAML;
return $tests;
}
public function testMultiLineComment()
{
$yaml = <<<YAML
parameters:
abc
# Comment
YAML;
$this->assertSame(['parameters' => 'abc'], $this->parser->parse($yaml));
}
}
class B