From 04d369d336e6e2ed6504d2e15310ffe4756d13fc Mon Sep 17 00:00:00 2001 From: Nyholm Date: Sat, 5 Dec 2020 16:54:24 +0100 Subject: [PATCH] [Config][TwigBundle] Fixed syntax error in config --- .../Bundle/TwigBundle/DependencyInjection/Configuration.php | 2 +- .../Config/Definition/Dumper/YamlReferenceDumper.php | 4 ++-- .../Tests/Definition/Dumper/YamlReferenceDumperTest.php | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php index fa333e132e..cf0a70fc30 100644 --- a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php @@ -88,7 +88,7 @@ class Configuration implements ConfigurationInterface ->arrayNode('globals') ->normalizeKeys(false) ->useAttributeAsKey('key') - ->example(['foo' => '"@bar"', 'pi' => 3.14]) + ->example(['foo' => '@bar', 'pi' => 3.14]) ->prototype('array') ->normalizeKeys(false) ->beforeNormalization() diff --git a/src/Symfony/Component/Config/Definition/Dumper/YamlReferenceDumper.php b/src/Symfony/Component/Config/Definition/Dumper/YamlReferenceDumper.php index c4baeccd18..89103efeaf 100644 --- a/src/Symfony/Component/Config/Definition/Dumper/YamlReferenceDumper.php +++ b/src/Symfony/Component/Config/Definition/Dumper/YamlReferenceDumper.php @@ -129,7 +129,7 @@ class YamlReferenceDumper // example if ($example && !\is_array($example)) { - $comments[] = 'Example: '.$example; + $comments[] = 'Example: '.Inline::dump($example); } $default = '' != (string) $default ? ' '.$default : ''; @@ -165,7 +165,7 @@ class YamlReferenceDumper $this->writeLine('# '.$message.':', $depth * 4 + 4); - $this->writeArray($example, $depth + 1); + $this->writeArray(array_map([Inline::class, 'dump'], $example), $depth + 1); } if ($children) { diff --git a/src/Symfony/Component/Config/Tests/Definition/Dumper/YamlReferenceDumperTest.php b/src/Symfony/Component/Config/Tests/Definition/Dumper/YamlReferenceDumperTest.php index 3cb9121ba6..1166aafb69 100644 --- a/src/Symfony/Component/Config/Tests/Definition/Dumper/YamlReferenceDumperTest.php +++ b/src/Symfony/Component/Config/Tests/Definition/Dumper/YamlReferenceDumperTest.php @@ -42,7 +42,7 @@ array: # this is a long # multi-line info text # which should be indented - child3: ~ # Example: example setting + child3: ~ # Example: 'example setting' EOL ], 'Regular nested' => ['array.child2', <<