From a549069a49b7959d7fd83fab2b95c03c9cae2ecc Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 9 Sep 2019 13:39:48 +0200 Subject: [PATCH 1/2] don't dump a scalar tag value on its own line --- src/Symfony/Component/Yaml/Dumper.php | 6 +----- .../Component/Yaml/Tests/DumperTest.php | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/Symfony/Component/Yaml/Dumper.php b/src/Symfony/Component/Yaml/Dumper.php index 7f38a5435c..a496dcc88e 100644 --- a/src/Symfony/Component/Yaml/Dumper.php +++ b/src/Symfony/Component/Yaml/Dumper.php @@ -115,15 +115,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 d4554392a2..1a1ef25a5a 100644 --- a/src/Symfony/Component/Yaml/Tests/DumperTest.php +++ b/src/Symfony/Component/Yaml/Tests/DumperTest.php @@ -532,10 +532,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 = << Date: Wed, 29 May 2019 18:52:38 +0200 Subject: [PATCH 2/2] Update GitHub PR template --- .github/PULL_REQUEST_TEMPLATE.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) 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#... -