Skip to content

Commit 5196974

Browse files
committed
minor #18084 [Yaml] Mention php/enum (alexandre-daubois)
This PR was merged into the 6.2 branch. Discussion ---------- [Yaml] Mention `php/enum` Fixes #18073 for 6.2 Will rebase once [the other one](#18083) is merged 🙂 Commits ------- a67aaf0 [Yaml] Mention `php/enum`
2 parents d96e62e + a67aaf0 commit 5196974

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)