Skip to content

Commit

Permalink
minor #3892 range example leads to Array to string conversion excepti…
Browse files Browse the repository at this point in the history
…on (devojifr)

This PR was merged into the 3.x branch.

Discussion
----------

range example leads to Array to string conversion exception

In templates documentation, a range example is displayed and leads to an Array to string conversion exception without a join filter.

Commits
-------

5349650 range example leads to Array to string conversion exception
  • Loading branch information
fabpot committed Oct 20, 2023
2 parents e4780e9 + 5349650 commit 86f5bdc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions doc/templates.rst
Original file line number Diff line number Diff line change
Expand Up @@ -752,11 +752,11 @@ The following operators don't fit into any of the other categories:
(this is syntactic sugar for the :doc:`range<functions/range>` function):

.. code-block:: twig

Check failure on line 754 in doc/templates.rst

View workflow job for this annotation

GitHub Actions / DOCtor-RST

Please add a blank line after " .. code-block:: twig
{{ 1..5 }}
{# join filter is applied to avoid Array to string conversion exception #}
{{ (1..5)|join(', ') }}
{# equivalent to #}
{{ range(1, 5) }}
{{ range(1, 5)|join(', ') }}
Note that you must use parentheses when combining it with the filter operator
due to the :ref:`operator precedence rules <twig-expressions>`:
Expand Down

0 comments on commit 86f5bdc

Please sign in to comment.