Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unused variable should not be trigger if the child mutate a parent's variable. #255

Open
RSickenberg opened this issue Aug 2, 2022 · 1 comment

Comments

@RSickenberg
Copy link

Steps required to reproduce the problem

  1. Use a parent template with a variable A
  2. The child template extending the parent one reset the A to another value.
  3. The parser still thinks A is unused on the children.

Expected Result

  • No error is thrown when the children change the parent variable.

Actual Result

  • An error (or warning, whatsoever) is thrown thinking the children variable is not used.
@ruudk
Copy link

ruudk commented Feb 24, 2023

Noticed the same, here a code sample that does it:

{% extends 'base.html.twig' %}

{% set layoutTitle = 'Home' %}

{% block main %}
Test
{% endblock %}
<html>
<head>
  <title>{{ layoutTitle }}</title>
</head>
<body>
{% block main %}{% endblock %}
</body>
</html>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants