@@ -453,15 +453,19 @@ By default, digit-only array keys are dumped as integers. You can use the
453
453
Dumping Double Quotes on Values
454
454
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
455
455
456
- By default, only unsafe values are double quoted. In some scenarios, quoting
457
- even safe values is encouraged by various inspectors. You can use the
458
- ``DUMP_FORCE_DOUBLE_QUOTES_ON_VALUES `` flag to enforce double quotes::
459
-
460
- $dumped = Yaml::dump(['foo' => 'bar']);
461
- // foo: bar
462
-
463
- $dumped = Yaml::dump(['foo' => 'bar'], 2, 4, Yaml::DUMP_FORCE_DOUBLE_QUOTES_ON_VALUES);
464
- // foo: "bar"
456
+ By default, only unsafe string values are enclosed in double quotes (for example,
457
+ if they are reserved words or contain newlines and spaces). Use the
458
+ ``DUMP_FORCE_DOUBLE_QUOTES_ON_VALUES `` flag to add double quotes to all string values::
459
+
460
+ $dumped = Yaml::dump([
461
+ 'foo' => 'bar', 'some foo' => 'some bar', 'x' => 3.14, 'y' => true, 'z' => null,
462
+ ]);
463
+ // foo: bar, 'some foo': 'some bar', x: 3.14, 'y': true, z: null
464
+
465
+ $dumped = Yaml::dump([
466
+ 'foo' => 'bar', 'some foo' => 'some bar', 'x' => 3.14, 'y' => true, 'z' => null,
467
+ ], 2, 4, Yaml::DUMP_FORCE_DOUBLE_QUOTES_ON_VALUES);
468
+ // "foo": "bar", "some foo": "some bar", "x": 3.14, "y": true, "z": null
465
469
466
470
.. versionadded :: 7.3
467
471
0 commit comments