Skip to content

Commit

Permalink
Fix CS
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Jan 3, 2025
1 parent d19f56f commit 053572e
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions doc/tags/types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@

.. versionadded:: 3.13

The ``types`` tag was added in Twig 3.13. This tag is **experimental** and can change based on usage and feedback.
The ``types`` tag was added in Twig 3.13. This tag is **experimental** and
can change based on usage and feedback.

The ``types`` tag declares the types of template variables.

To do this, specify a :ref:`mapping <twig-expressions>` of names to their types as strings.
To do this, specify a :ref:`mapping <twig-expressions>` of names to their types
as strings.

Here is how to declare that ``is_correct`` is a boolean, while ``score`` is a number (see note below):
Here is how to declare that ``is_correct`` is a boolean, while ``score`` is a
number (see note below):

.. code-block:: twig
Expand All @@ -29,13 +32,14 @@ You can declare variables as optional by adding the ``?`` suffix:
By default, this tag does not affect the template compilation or runtime behavior.

Its purpose is to enable designers and developers to document and specify the context's available
and/or required variables. While Twig itself does not validate variables or their types, this tag enables extensions
to do this.
Its purpose is to enable designers and developers to document and specify the
context's available and/or required variables. While Twig itself does not
validate variables or their types, this tag enables extensions to do this.

Additionally, :ref:`Twig extensions <creating_extensions>` can analyze these tags to perform compile-time and
runtime analysis of templates.
Additionally, :ref:`Twig extensions <creating_extensions>` can analyze these
tags to perform compile-time and runtime analysis of templates.

.. note::

The syntax for and contents of type strings are intentionally left out of scope.
The syntax for and contents of type strings are intentionally left out of
scope.

0 comments on commit 053572e

Please sign in to comment.