8000 minor #20510 [Yaml] feature #59315 Add compact nested mapping suppor… · symfony/symfony-docs@7261af2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7261af2

Browse files
committed
minor #20510 [Yaml] feature #59315 Add compact nested mapping support to Dumper (gr8b)
This PR was squashed before being merged into the 7.3 branch. Discussion ---------- [Yaml] feature #59315 Add compact nested mapping support to Dumper Documentation update for YAML Dumper feature `Yaml::DUMP_COMPACT_NESTED_MAPPING`. Commits ------- 12bb604 [Yaml] feature #59315 Add compact nested mapping support to Dumper
2 parents 26cbad4 + 12bb604 commit 7261af2

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

components/yaml.rst

+28
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,34 @@ By default, digit-only array keys are dumped as integers. You can use the
450450
$dumped = Yaml::dump([200 => 'foo'], 2, 4, Yaml::DUMP_NUMERIC_KEY_AS_STRING);
451451
// '200': foo
452452

453+
Dumping Collection of Maps
454+
~~~~~~~~~~~~~~~~~~~~~~~~~~
455+
456+
By default, the collection of maps uses a hyphen on a separate line as a delimiter.
457+
To use the delimiter line as part of the map dump, use the ``Yaml::DUMP_COMPACT_NESTED_MAPPING`` flag.
458+
459+
Dump without flag set:
460+
461+
.. code-block:: yaml
462+
463+
planets:
464+
-
465+
name: Mercury
466+
distance: 57910000
467+
-
468+
name: Jupiter
469+
distance: 778500000
470+
471+
Dump with ``Yaml::DUMP_COMPACT_NESTED_MAPPING`` flag set:
472+
473+
.. code-block:: yaml
474+
475+
planets:
476+
- name: Mercury
477+
distance: 57910000
478+
- name: Jupiter
479+
distance: 778500000
480+
453481
Syntax Validation
454482
~~~~~~~~~~~~~~~~~
455483

0 commit comments

Comments
 (0)
0