Merge branch '4.3' into 4.4
* 4.3: Update GitHub PR template don't dump a scalar tag value on its own line
This commit is contained in:
commit
3536b1371b
|
@ -3,20 +3,19 @@
|
|||
| Branch? | 4.4 for features / 3.4 or 4.3 for bug fixes <!-- see below -->
|
||||
| Bug fix? | yes/no
|
||||
| New feature? | yes/no <!-- please update src/**/CHANGELOG.md files -->
|
||||
| BC breaks? | no <!-- see https://symfony.com/bc -->
|
||||
| Deprecations? | yes/no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
|
||||
| Tests pass? | yes <!-- please add some, will be required by reviewers -->
|
||||
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
|
||||
| Tickets | Fix #... <!-- prefix each issue number with "Fix #", if any -->
|
||||
| License | MIT
|
||||
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
|
||||
|
||||
<!--
|
||||
Replace this notice by a short README for your feature/bugfix. This will help people
|
||||
understand your PR and can be used as a start for the documentation.
|
||||
|
||||
Additionally (see https://symfony.com/roadmap):
|
||||
- Always add tests and ensure they pass.
|
||||
- Never break backward compatibility (see https://symfony.com/bc).
|
||||
- Bug fixes must be submitted against the lowest maintained branch where they apply
|
||||
(lowest branches are regularly merged to upper ones so they get the fixes too).
|
||||
(lowest branches are regularly merged to upper ones so they get the fixes too.)
|
||||
- Features and deprecations must be submitted against branch 4.4.
|
||||
- Legacy code removals go to the master branch.
|
||||
-->
|
||||
|
|
|
@ -80,15 +80,11 @@ class Dumper
|
|||
if ($value instanceof TaggedValue) {
|
||||
$output .= sprintf('%s%s !%s', $prefix, $dumpAsMap ? Inline::dump($key, $flags).':' : '-', $value->getTag());
|
||||
|
||||
if ($inline - 1 <= 0) {
|
||||
if ($inline - 1 <= 0 || null === $value->getValue() || is_scalar($value->getValue())) {
|
||||
$output .= ' '.$this->dump($value->getValue(), $inline - 1, 0, $flags)."\n";
|
||||
} 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;
|
||||
|
|
|
@ -466,10 +466,21 @@ YAML;
|
|||
'user2' => new TaggedValue('user', 'john'),
|
||||
];
|
||||
$expected = <<<YAML
|
||||
user1: !user
|
||||
jane
|
||||
user2: !user
|
||||
john
|
||||
user1: !user jane
|
||||
user2: !user john
|
||||
|
||||
YAML;
|
||||
|
||||
$this->assertSame($expected, $this->dumper->dump($data, 2));
|
||||
}
|
||||
|
||||
public function testDumpingNotInlinedNullTaggedValue()
|
||||
{
|
||||
$data = [
|
||||
'foo' => new TaggedValue('bar', null),
|
||||
];
|
||||
$expected = <<<YAML
|
||||
foo: !bar null
|
||||
|
||||
YAML;
|
||||
|
||||
|
|
Reference in New Issue