Files
Twig/tests/Fixtures/macros/varargs_implicit.legacy.test
2026-07-30 13:53:24 +02:00

25 lines
924 B
Plaintext

--TEST--
macro with arbitrary arguments collected in the implicit "varargs" variable (deprecated)
--DEPRECATION--
Since twig/twig 3.29: Passing more arguments than the macro "test1" accepts is deprecated and will throw in Twig 4.0; declare a variadic argument ("...name") in the macro definition to accept extra arguments (in "index.twig" at line 12).
Since twig/twig 3.29: Passing more arguments than the macro "test2" accepts is deprecated and will throw in Twig 4.0; declare a variadic argument ("...name") in the macro definition to accept extra arguments (in "index.twig" at line 13).
--TEMPLATE--
{% from _self import test1, test2 %}
{% macro test1(var) %}
{{- var }}: {{ varargs|join(", ") }}
{% endmacro %}
{% macro test2() %}
{{- varargs|join(", ") }}
{% endmacro %}
{{ test1("foo", "bar", "foobar") }}
{{ test2("foo", "bar", "foobar") }}
--DATA--
return []
--EXPECT--
foo: bar, foobar
foo, bar, foobar