8000 Added docs for Yaml::PARSE_CONSTANT by javiereguiluz · Pull Request #7194 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

Added docs for Yaml::PARSE_CONSTANT #7194

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Added docs for Yaml::PARSE_CONSTANT
  • Loading branch information
javiereguiluz committed Nov 29, 2016
commit 5a0125768489682b8bd3763a9657711b2c105032
11 changes: 11 additions & 0 deletions components/yaml.rst
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,17 @@ flag::
// Line
// String

Parsing PHP Constants
~~~~~~~~~~~~~~~~~~~~~

By default the YAML parser treats the PHP constants included in the contents as
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comma after "default"?

regular strings. Use the ``PARSE_CONSTANT`` flag and the special ``!php/const:``
syntax to parse them as proper PHP constants::

$yaml = '{ foo: PHP_INT_SIZE, bar: !php/const:PHP_INT_SIZE }';
$parameters = Yaml::parse($yaml, Yaml::PARSE_CONSTANT);
// $parameters = array('foo' => 'PHP_INT_SIZE', 'bar' => 8);

Syntax Validation
~~~~~~~~~~~~~~~~~

Expand Down
0