mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-11 18:06:46 +00:00
ff4d01f940
The implementation contains an optimized implementation of the function for the common case of using a string literal as the argument. It will validate the enum existence during compilation and compile the code to use `MyEnum::cases()` directly.
11 lines
369 B
Plaintext
11 lines
369 B
Plaintext
--TEST--
|
|
"enum_cases" function with missing \ escaping
|
|
--CONDITION--
|
|
\PHP_VERSION_ID >= 80100
|
|
--TEMPLATE--
|
|
{% for c in enum_cases('Twig\Tests\DummyBackedEnum') %}
|
|
{{~ c.name }}
|
|
{% endfor %}
|
|
--EXCEPTION--
|
|
Twig\Error\SyntaxError: The first argument of the "enum_cases" function must be the name of an enum, "TwigTestsDummyBackedEnum" given in "index.twig" at line 2.
|