TwigStan is a static analyzer for Twig templates powered by PHPStan.
Caution
This is very experimental
Note
This project requires a significant amount of my time and effort to develop. If you find it valuable, please consider sponsoring me to support its continued growth and give it a star! ⭐️ Your support is truly appreciated! 🙏
TwigStan uses Twig to compile templates to PHP code. It then optimizes the compiled PHP code slightly, allowing PHPStan to analyze it better. It then reports any errors back to the original template and line number.
The process consists of the following steps: