Replies: 1 comment
-
To start off, this is a really cool project with a laudable goal. Let's fix our templates and prevent those silly bugs already! I have a project with the same name and similar goals, but different implementation. Mine is a Twig extension which adds inspections compile-time (useful for a CLI run in CI) and runtime (useful for fast feedback while developing). Most of the (envisioned) inspections could be done way better by PHPStan, but only if PHPStan can really understand the templates, plus, ideally, how templates are called / rendered. This is certainly the main benefit of this benefit: bringing the extensive, awesome analysis of PHPStan to bear on templates. My extension has the benefit of probably being simpler to use: just add it to your Twig environment and either compile all templates in CLI, or watch what happens while using (or E2E-testing) your app. The drawback is that it has to duplicate inspections already implemented in PHPStan. By the way: Ruud and I are not fighting over the name. I actually think his project is more worthy of the name. I'll investigate whether this project can work in our code base, which is not fully Symfony, and will provide my notes and suggestions afterwards. |
Beta Was this translation helpful? Give feedback.
-
Hey all,
I created a first version of a static analyzer for Twig templates. It's powered by PHPStan.
You can check it out here: https://github.com/twigstan/twigstan. In the readme I tried to document as many things. You can look at the tests directory for examples.
I'd like to hear feedback. Please be gentle as this is a very first version and some things are not working (yet) or implemented naively or done partially.
Beta Was this translation helpful? Give feedback.
All reactions