mirror of
https://github.com/twigphp/Twig.git
synced 2026-08-31 12:37:15 +00:00
Document storing an enum in a variable to avoid repeating its FQCN
This commit is contained in:
@@ -32,6 +32,15 @@
|
||||
|
||||
When using a string literal for the ``enum`` argument, it will be validated during compile time to be a valid enum name.
|
||||
|
||||
As the FQCN can be long, you can store the enum in a variable to avoid repeating
|
||||
it:
|
||||
|
||||
.. code-block:: twig
|
||||
|
||||
{% set suite = enum('App\\CardSuite') %}
|
||||
{{ suite.Clubs.value }} {# "clubs" #}
|
||||
{{ suite.Spades.value }} {# "spades" #}
|
||||
|
||||
Arguments
|
||||
---------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user