twigcs
twigcs copied to clipboard
Unused variable should not be trigger if the child mutate a parent's variable.
Steps required to reproduce the problem
- Use a parent template with a variable
A
- The child template extending the parent one reset the
A
to another value. - 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.
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>