File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -1111,13 +1111,21 @@ parentheses:
11111111Destructuring
11121112-------------
11131113
1114+ .. versionadded :: 3.23
1115+
1116+ Destructuring was added in Twig 3.23.
1117+
11141118Destructuring allows you to extract values from sequences and assign them to
11151119variables in a single operation using the ``= `` :ref: `assignment operator
11161120<templates-assignment-operator>`.
11171121
1118- .. versionadded :: 3.23
1122+ Like in PHP, destructuring expressions return the right-hand side value, not
1123+ the extracted values:
11191124
1120- Destructuring was added in Twig 3.23.
1125+ .. code-block :: twig
1126+
1127+ {# returns the full user object, allowing chained access #}
1128+ {{ ({name} = user).email }}
11211129
11221130 Sequence Destructuring
11231131~~~~~~~~~~~~~~~~~~~~~~
You can’t perform that action at this time.
0 commit comments