Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 409ec02

Browse filesBrowse files
committed
Tweaks
1 parent 068abee commit 409ec02
Copy full SHA for 409ec02

File tree

Expand file treeCollapse file tree

1 file changed

+13
-9
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+13
-9
lines changed

‎components/yaml.rst

Copy file name to clipboardExpand all lines: components/yaml.rst
+13-9Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -453,15 +453,19 @@ By default, digit-only array keys are dumped as integers. You can use the
453453
Dumping Double Quotes on Values
454454
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
455455

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
465469

466470
.. versionadded:: 7.3
467471

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.