fix(yml): fix comment in milti line value
This commit is contained in:
parent
aefc7f54d7
commit
dd945e375c
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
Reference in New Issue