Skip to content

Commit 7cf810e

Browse files
committed
minor #14531 Throw Exception if twig variable is not found (ybenhssaien)
This PR was submitted for the 5.1 branch but it was merged into the 4.4 branch instead. Discussion ---------- Throw Exception if twig variable is not found An exception of type `Twig\Error\RuntimeError` is thrown when a variable is not found while `strict_variables` is enabled ![image](https://user-images.githubusercontent.com/7301643/98787347-aeba2700-23ff-11eb-9957-4ac56ff4e6ca.png) <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/releases for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `5.x` for features of unreleased versions). --> Commits ------- 3547418 Throw Exception if twig variable is not found
2 parents c732edf + 3547418 commit 7cf810e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

templates.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ 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`` exception if ``strict_variables`` config is enabled.
168168

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

0 commit comments

Comments
 (0)