This PR addresses several issues around the correctness of templates.
Being able to parse and compile a template does not mean that it is semantically correct. To enforce correctness, we currently have several places where we deal with it:
Parser::filterBodyNodes(): This method is a mix of ensuring the correctness of a template, but it also changes the body node of a child template (something that is always needed and not part of the correctness checks)
ExtendsTokenParser: It checks that an extend tag is not embedded into a block or a macro. The extend tag is not the only one that must be at the root of a template
This PR introduces a new CorrectnessNodeVisitor that has the responsibility to check that a template is semantically correct. It's the continuation of work that started a long time ago in #2687 (where I mentioned the weirdness of some supported templates like those mentioned in #3926 and deprecated by this PR).
Closes #3698: Having a use tag embedded in another tag (like if in the mentioned PR) is deprecated and will not be possible in 4.0.
This PR addresses several issues around the correctness of templates. Being able to parse and compile a template does not mean that it is semantically correct. To enforce correctness, we currently have several places where we deal with it:
Parser::filterBodyNodes()
: This method is a mix of ensuring the correctness of a template, but it also changes the body node of a child template (something that is always needed and not part of the correctness checks)ExtendsTokenParser
: It checks that anextend
tag is not embedded into a block or a macro. Theextend
tag is not the only one that must be at the root of a templateThis PR introduces a new
CorrectnessNodeVisitor
that has the responsibility to check that a template is semantically correct. It's the continuation of work that started a long time ago in #2687 (where I mentioned the weirdness of some supported templates like those mentioned in #3926 and deprecated by this PR).Closes #3698: Having a
use
tag embedded in another tag (likeif
in the mentioned PR) is deprecated and will not be possible in 4.0.