Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit068abee

Browse files
committed
minor#20758 [Yaml] Add theYaml::DUMP_FORCE_DOUBLE_QUOTES_ON_VALUES flag to enforce double quotes around string values (alamirault)
This PR was merged into the 7.3 branch.Discussion----------[Yaml] Add the `Yaml::DUMP_FORCE_DOUBLE_QUOTES_ON_VALUES` flag to enforce double quotes around string valuesFix#20734Commits-------152d436 [Yaml] Add the Yaml::DUMP_FORCE_DOUBLE_QUOTES_ON_VALUES flag to enforce double quotes around string values
2 parents612aead +152d436 commit068abee

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

‎components/yaml.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,23 @@ By default, digit-only array keys are dumped as integers. You can use the
450450
$dumped = Yaml::dump([200 => 'foo'], 2, 4, Yaml::DUMP_NUMERIC_KEY_AS_STRING);
451451
// '200': foo
452452

453+
Dumping Double Quotes on Values
454+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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"
465+
466+
..versionadded::7.3
467+
468+
The ``Yaml::DUMP_FORCE_DOUBLE_QUOTES_ON_VALUES`` flag was introduced in Symfony 7.3.
469+
453470
Dumping Collection of Maps
454471
~~~~~~~~~~~~~~~~~~~~~~~~~~
455472

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp