Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
minor #41944 [TwigBundle] Improve comment on error silencing (Stefan …
…Kruppa)

This PR was merged into the 5.4 branch.

Discussion
----------

[TwigBundle] Improve comment on error silencing

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #41922
| License       | MIT
| Doc PR        |

As discussed in the ticket, I think the comment needs to be more expressive.

Commits
-------

51124d5 [TwigBundle] Improve comment on error silencing
  • Loading branch information
fabpot committed Jul 3, 2021
2 parents e1b352e + 51124d5 commit 5778f9a
Showing 1 changed file with 8 additions and 2 deletions.
Expand Up @@ -56,8 +56,14 @@ public function warmUp(string $cacheDir)
$files[] = (new \ReflectionClass($template->unwrap()))->getFileName();
}
} catch (Error $e) {
// problem during compilation, give up
// might be a syntax error or a non-Twig template
/*
* Problem during compilation, give up for this template (e.g. syntax errors).
* Failing silently here allows to ignore templates that rely on functions that aren't available in
* the current environment. For example, the WebProfilerBundle shouldn't be available in the prod
* environment, but some templates that are never used in prod might rely on functions the bundle provides.
* As we can't detect which templates are "really" important, we try to load all of them and ignore
* errors. Error checks may be performed by calling the lint:twig command.
*/
}
}

Expand Down

0 comments on commit 5778f9a

Please sign in to comment.