8000 [Yaml] feature #59315 Add compact nested mapping support to Dumper · symfony/symfony-docs@12bb604 · GitHub
[go: up one dir, main page]

Skip to content

Commit 12bb604

Browse files
gr8bjaviereguiluz
gr8b
authored andcommitted
[Yaml] feature #59315 Add compact nested mapping support to Dumper
1 parent a316ae8 commit 12bb604

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
@@ -440,6 +440,34 @@ By default, digit-only array keys are dumped as integers. You can use the
440440
$dumped = Yaml::dump([200 => 'foo'], 2, 4, Yaml::DUMP_NUMERIC_KEY_AS_STRING);
441441
// '200': foo
442442

443+
Dumping Collection of Maps
444+
~~~~~~~~~~~~~~~~~~~~~~~~~~
445+
446+
By default, the collection of maps uses a hyphen on a separate line as a delimiter.
447+
To use the delimiter line as part of the map dump, use the ``Yaml::DUMP_COMPACT_NESTED_MAPPING`` flag.
448+
449+
Dump without flag set:
450+
451+
.. code-block:: yaml
452+
453+
planets:
454+
-
455+
name: Mercury
456+
distance: 57910000
457+
-
458+
name: Jupiter
459+
distance: 778500000
460+
461+
Dump with ``Yaml::DUMP_COMPACT_NESTED_MAPPING`` flag set:
462+
463+
.. code-block:: yaml
464+
465+
planets:
466+
- name: Mercury
467+
distance: 57910000
468+
- name: Jupiter
469+
distance: 778500000
470+
443471
Syntax Validation
444472
~~~~~~~~~~~~~~~~~
445473

0 commit comments

Comments
 (0)
0