mirror of
https://github.com/twigphp/Twig.git
synced 2026-08-30 20:16:45 +00:00
Apply suggestions from code review
Co-authored-by: Fabien Potencier <fabien@potencier.org>
This commit is contained in:
committed by
Fabien Potencier
parent
2b95bd6092
commit
dacbe51b3a
@@ -1,11 +1,11 @@
|
||||
``invoke``
|
||||
=======
|
||||
==========
|
||||
|
||||
The ``invoke`` filter invokes an arrow function with the given arguments:
|
||||
|
||||
.. code-block:: twig
|
||||
|
||||
{% set person = {first: "Bob", last: "Smith"} %}
|
||||
{% set person = { first: "Bob", last: "Smith" } %}
|
||||
{% set func = p => "#{p.first} #{p.last}" %}
|
||||
|
||||
{{ func|invoke(person) }}
|
||||
@@ -16,4 +16,4 @@ Note that the arrow function has access to the current context.
|
||||
Arguments
|
||||
---------
|
||||
|
||||
All given arguments are passed to the arrow function
|
||||
All given arguments are passed to the arrow function.
|
||||
|
||||
+2
-2
@@ -1018,9 +1018,9 @@ The following operators don't fit into any of the other categories:
|
||||
Arrow function support for functions, macros, and method calls was added in
|
||||
Twig 3.15 (filters and tests were already supported).
|
||||
|
||||
Arrow functions can be invoked using the ``invoke`` filter.
|
||||
Arrow functions can be called using the ``invoke`` filter:
|
||||
|
||||
.. versionadded:: 3.19
|
||||
.. versionadded:: 3.19
|
||||
|
||||
The ``invoke`` filter has been added in Twig 3.19.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user