diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 52ffbb2a4d..b863dea0cb 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -3,20 +3,19 @@ | Branch? | 4.4 for features / 3.4 or 4.3 for bug fixes | Bug fix? | yes/no | New feature? | yes/no -| BC breaks? | no | Deprecations? | yes/no -| Tests pass? | yes -| Fixed tickets | #... +| Tickets | Fix #... | License | MIT | Doc PR | symfony/symfony-docs#... - diff --git a/src/Symfony/Component/Yaml/Dumper.php b/src/Symfony/Component/Yaml/Dumper.php index 8fa66bd986..5175ae4d11 100644 --- a/src/Symfony/Component/Yaml/Dumper.php +++ b/src/Symfony/Component/Yaml/Dumper.php @@ -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; diff --git a/src/Symfony/Component/Yaml/Tests/DumperTest.php b/src/Symfony/Component/Yaml/Tests/DumperTest.php index b355070fbe..2b4d2853ff 100644 --- a/src/Symfony/Component/Yaml/Tests/DumperTest.php +++ b/src/Symfony/Component/Yaml/Tests/DumperTest.php @@ -466,10 +466,21 @@ YAML; 'user2' => new TaggedValue('user', 'john'), ]; $expected = <<assertSame($expected, $this->dumper->dump($data, 2)); + } + + public function testDumpingNotInlinedNullTaggedValue() + { + $data = [ + 'foo' => new TaggedValue('bar', null), + ]; + $expected = <<