Skip to content

Commit a67aaf0

Browse files
alexandre-dauboisjaviereguiluz
authored andcommitted
[Yaml] Mention php/enum
1 parent d96e62e commit a67aaf0

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

reference/formats/yaml.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,21 @@ official YAML specification but are useful in Symfony applications:
338338
data:
339339
my_object: !php/object 'O:8:"stdClass":1:{s:3:"bar";i:2;}'
340340
341+
* ``!php/enum`` allows to use a PHP enum case. This tag takes the fully-qualified
342+
class name of the enum case as its argument:
343+
344+
.. code-block:: yaml
345+
346+
data:
347+
# You can use the typed enum case...
348+
operator_type: !php/enum App\Operator\Enum\Type::Or
349+
# ... or you can also use "->value" to directly use the value of a BackedEnum case
350+
operator_type: !php/enum App\Operator\Enum\Type::Or->value
351+
352+
.. versionadded:: 6.2
353+
354+
The ``!php/enum`` tag was introduced in Symfony 6.2.
355+
341356
Unsupported YAML Features
342357
~~~~~~~~~~~~~~~~~~~~~~~~~
343358

0 commit comments

Comments
 (0)