We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
php/enum
1 parent d96e62e commit a67aaf0Copy full SHA for a67aaf0
reference/formats/yaml.rst
@@ -338,6 +338,21 @@ official YAML specification but are useful in Symfony applications:
338
data:
339
my_object: !php/object 'O:8:"stdClass":1:{s:3:"bar";i:2;}'
340
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
356
Unsupported YAML Features
357
~~~~~~~~~~~~~~~~~~~~~~~~~
358
0 commit comments