8000 Merge branch '5.1' into 5.x · symfony/symfony-docs@8b678b6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8b678b6

Browse files
committed
Merge branch '5.1' into 5.x
* 5.1: Throw Exception if twig variable is not found
2 parents ef1b95a + e4848d7 commit 8b678b6

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

reference/configuration/twig.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,8 @@ the directory defined in the :ref:`default_path option <config-twig-default-path
358358
359359
Read more about :ref:`template directories and namespaces <templates-namespaces>`.
360360

361+
.. _config-twig-strict-variables:
362+
361363
strict_variables
362364
~~~~~~~~~~~~~~~~
363365

templates.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,9 @@ in the following order:
164164
#. ``$foo->getBar()`` (object and *getter* method);
165165
#. ``$foo->isBar()`` (object and *isser* method);
166166
#. ``$foo->hasBar()`` (object and *hasser* method);
167-
#. If none of the above exists, use ``null``.
167+
#. If none of the above exists, use ``null`` (or throw a ``Twig\Error\RuntimeError``
168+
exception if the :ref:`strict_variables <config-twig-strict-variables>`
169+
option is enabled).
168170

169171
This allows to evolve your application code without having to change the
170172
template code (you can start with array variables for the application proof of

0 commit comments

Comments
 (0)
0