Files
Fabien Potencier b03de9de05 Merge branch '3.x' into 4.x
* 3.x:
  Update CHANGELOG
  Fix accessing arrays with stringable objects as key
  Update inky_to_html.rst: Updating link
  Update replace.rst
  [Doc] Tweaks in the escaping article
  Compile 'index' with repr (not string) in EmbedNode
  Introduce registerUndefinedTestCallback
  Fix intl test
  Bump minimum Commonmark requirement
  Support two words test guard
  Bump version
  Improve documentation examples for `enum` and `enum_cases`
  Avoid errors when failing to guess the template info for an error
  Add note to format_datetime explaining how to install required extensions
  Fix compatibility layer
2025-10-29 11:55:46 -04:00

19 lines
433 B
ReStructuredText

``enum_cases``
==============
``enum_cases`` returns the list of cases for a given enum:
.. code-block:: twig
{% for case in enum_cases('App\\CardSuite') %}
{{ case.value }}
{% endfor %}
{# "clubs", "spades", "hearts", "diamonds" #}
When using a string literal for the ``enum`` argument, it will be validated during compile time to be a valid enum name.
Arguments
---------
* ``enum``: The FQCN of the enum