bug #33377 [Yaml] fix dumping not inlined scalar tag values (xabbuh)
This PR was merged into the 3.4 branch.
Discussion
----------
[Yaml] fix dumping not inlined scalar tag values
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #33354
| License | MIT
| Doc PR |
Commits
-------
390f4f4329
fix dumping not inlined scalar tag values
This commit is contained in:
commit
b3cf4fb192
|
@ -120,6 +120,10 @@ class Dumper
|
|||
} else {
|
||||
$output .= "\n";
|
||||
$output .= $this->dump($value->getValue(), $inline - 1, $dumpAsMap ? $indent + $this->indentation : $indent + 2, $flags);
|
||||
|
||||
if (is_scalar($value->getValue())) {
|
||||
$output .= "\n";
|
||||
}
|
||||
}
|
||||
|
||||
continue;
|
||||
|
|
|
@ -525,6 +525,23 @@ YAML;
|
|||
$this->assertSame($expected, $yaml);
|
||||
}
|
||||
|
||||
public function testDumpingNotInlinedScalarTaggedValue()
|
||||
{
|
||||
$data = [
|
||||
'user1' => new TaggedValue('user', 'jane'),
|
||||
'user2' => new TaggedValue('user', 'john'),
|
||||
];
|
||||
$expected = <<<YAML
|
||||
user1: !user
|
||||
jane
|
||||
user2: !user
|
||||
john
|
||||
|
||||
YAML;
|
||||
|
||||
$this->assertSame($expected, $this->dumper->dump($data, 2));
|
||||
}
|
||||
|
||||
public function testDumpMultiLineStringAsScalarBlock()
|
||||
{
|
||||
$data = [
|
||||
|
|
Reference in New Issue