File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -418,6 +418,22 @@ you can dump them as ``~`` with the ``DUMP_NULL_AS_TILDE`` flag::
418418 $dumped = Yaml::dump(['foo' => null], 2, 4, Yaml::DUMP_NULL_AS_TILDE);
419419 // foo: ~
420420
421+ Dumping Numeric Keys as Strings
422+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
423+
424+ By default, digit-only array keys are dumped as integers. You can use the
425+ ``DUMP_NUMERIC_KEY_AS_STRING `` flag if you want to dump string-only keys::
426+
427+ $dumped = Yaml::dump([200 => 'foo']);
428+ // 200: foo
429+
430+ $dumped = Yaml::dump([200 => 'foo'], 2, 4, Yaml::DUMP_NUMERIC_KEY_AS_STRING);
431+ // '200': foo
432+
433+ .. versionadded :: 6.3
434+
435+ The ``DUMP_NUMERIC_KEY_AS_STRING `` flag was introduced in Symfony 6.3.
436+
421437Syntax Validation
422438~~~~~~~~~~~~~~~~~
423439
You can’t perform that action at this time.
0 commit comments