mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-19 05:46:41 +00:00
minor #4755 Add a not about the return value of destructuring (fabpot)
This PR was merged into the 3.x branch.
Discussion
----------
Add a not about the return value of destructuring
Commits
-------
c38868cdd0 Add a not about the return value of destructuring
This commit is contained in:
+10
-2
@@ -1111,13 +1111,21 @@ parentheses:
|
||||
Destructuring
|
||||
-------------
|
||||
|
||||
.. versionadded:: 3.23
|
||||
|
||||
Destructuring was added in Twig 3.23.
|
||||
|
||||
Destructuring allows you to extract values from sequences and assign them to
|
||||
variables in a single operation using the ``=`` :ref:`assignment operator
|
||||
<templates-assignment-operator>`.
|
||||
|
||||
.. versionadded:: 3.23
|
||||
Like in PHP, destructuring expressions return the right-hand side value, not
|
||||
the extracted values:
|
||||
|
||||
Destructuring was added in Twig 3.23.
|
||||
.. code-block:: twig
|
||||
|
||||
{# returns the full user object, allowing chained access #}
|
||||
{{ ({name} = user).email }}
|
||||
|
||||
Sequence Destructuring
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Reference in New Issue
Block a user