Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
minor #2139 Improved the error message when a child template defines …
…contents outside parent blocks (javiereguiluz) This PR was squashed before being merged into the 1.x branch (closes #2139). Discussion ---------- Improved the error message when a child template defines contents outside parent blocks ### Context When using template inheritance, you cannot put template contents outside Twig blocks (except some special tags (form_theme), macros, etc.) Sadly, making this mistake is very common when learning Twig. ### Problem The error message associated to this issue is cryptic and "impossible to understand" for newcomers: ``` A template that extends another one cannot have a body. ``` I recently delivered a Symfony training and nobody was able to understand what the error was. They didn't have the slightest clue. I explained it to them ... and a few days latter they had the same problem and again they couldn't remember what this error was related to. ### Solution Most of the Twig/Symfony errors are very helpful. Let's improve this one to make it useful too. Two years ago I tried to fix this error message (see #1396). Let's see if this new PR is accepted. Commits ------- 23f53d5 Improved the error message when a child template defines contents outside parent blocks
- Loading branch information