Skip to content

Commit c8c2597

Browse files
committed
minor #20523 [Yaml] Add support for dumping null as an empty value by using the Yaml::DUMP_NULL_AS_EMPTY flag (alexandre-daubois)
This PR was merged into the 7.3 branch. Discussion ---------- [Yaml] Add support for dumping `null` as an empty value by using the `Yaml::DUMP_NULL_AS_EMPTY` flag Fix #20495 Commits ------- ab69163 [Yaml] Add support for dumping `null` as an empty value by using the `Yaml::DUMP_NULL_AS_EMPTY` flag
2 parents 98937bb + ab69163 commit c8c2597

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

components/yaml.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,16 @@ you can dump them as ``~`` with the ``DUMP_NULL_AS_TILDE`` flag::
428428
$dumped = Yaml::dump(['foo' => null], 2, 4, Yaml::DUMP_NULL_AS_TILDE);
429429
// foo: ~
430430

431+
Another valid representation of the ``null`` value is an empty string. You can
432+
use the ``DUMP_NULL_AS_EMPTY`` flag to dump null values as empty strings::
433+
434+
$dumped = Yaml::dump(['foo' => null], 2, 4, Yaml::DUMP_NULL_AS_EMPTY);
435+
// foo:
436+
437+
.. versionadded:: 7.3
438+
439+
The ``DUMP_NULL_AS_EMPTY`` flag was introduced in Symfony 7.3.
440+
431441
Dumping Numeric Keys as Strings
432442
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
433443

0 commit comments

Comments
 (0)