Merge branch '3.4' into 4.3

* 3.4:
  Update GitHub PR template
  don't dump a scalar tag value on its own line
This commit is contained in:
Nicolas Grekas 2019-09-10 18:53:00 +02:00
commit 13ff9f94c5
3 changed files with 20 additions and 14 deletions

View File

@ -3,20 +3,19 @@
| Branch? | 4.4 for features / 3.4 or 4.3 for bug fixes <!-- see below --> | Branch? | 4.4 for features / 3.4 or 4.3 for bug fixes <!-- see below -->
| Bug fix? | yes/no | Bug fix? | yes/no
| New feature? | yes/no <!-- please update src/**/CHANGELOG.md files --> | 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 --> | Deprecations? | yes/no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass? | yes <!-- please add some, will be required by reviewers --> | Tickets | Fix #... <!-- prefix each issue number with "Fix #", if any -->
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
| License | MIT | License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features --> | Doc PR | symfony/symfony-docs#... <!-- required for new features -->
<!-- <!--
Replace this notice by a short README for your feature/bugfix. This will help people 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. understand your PR and can be used as a start for the documentation.
Additionally (see https://symfony.com/roadmap): 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 - 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. - Features and deprecations must be submitted against branch 4.4.
- Legacy code removals go to the master branch. - Legacy code removals go to the master branch.
--> -->

View File

@ -80,15 +80,11 @@ class Dumper
if ($value instanceof TaggedValue) { if ($value instanceof TaggedValue) {
$output .= sprintf('%s%s !%s', $prefix, $dumpAsMap ? Inline::dump($key, $flags).':' : '-', $value->getTag()); $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"; $output .= ' '.$this->dump($value->getValue(), $inline - 1, 0, $flags)."\n";
} else { } else {
$output .= "\n"; $output .= "\n";
$output .= $this->dump($value->getValue(), $inline - 1, $dumpAsMap ? $indent + $this->indentation : $indent + 2, $flags); $output .= $this->dump($value->getValue(), $inline - 1, $dumpAsMap ? $indent + $this->indentation : $indent + 2, $flags);
if (is_scalar($value->getValue())) {
$output .= "\n";
}
} }
continue; continue;

View File

@ -466,10 +466,21 @@ YAML;
'user2' => new TaggedValue('user', 'john'), 'user2' => new TaggedValue('user', 'john'),
]; ];
$expected = <<<YAML $expected = <<<YAML
user1: !user user1: !user jane
jane user2: !user john
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; YAML;