You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the extension is unaware of usage in templates (like Twig).
I'm working on TwigStan. TwigStan is a separate tool that invokes PHPStan (it's not an extension). It compiles Twig templates to PHP and then cleans them up. It then executes PHPStan.
I was thinking: if TwigStan runs PHPStan with dead-code-detector extension enabled, we could export the MethodCallCollector to a JSON file. This data has all the method calls from the Twig templates to entities / methods.
Then, when normally running PHPStan on the whole project, we could include the data from JSON with the other MethodCallCollector.
Now, dead-code-detector has a full picture about calls in PHP and in Twig.
The downside of this approach is obviously that the dead-code-detector extension has a dependency on the TwigStan run.
But I think it could be fine to only run dead-code-detector on CI, after TwigStan was completed.
The text was updated successfully, but these errors were encountered:
It compiles Twig templates to PHP and then cleans them up. It then executes PHPStan.
If your "methods called in twig" can be exported to some json, then it should be easy to create some TwigEntrypointProvider that reads that and marks such methods as used, no?
Currently, the extension is unaware of usage in templates (like Twig).
I'm working on TwigStan. TwigStan is a separate tool that invokes PHPStan (it's not an extension). It compiles Twig templates to PHP and then cleans them up. It then executes PHPStan.
I was thinking: if TwigStan runs PHPStan with dead-code-detector extension enabled, we could export the MethodCallCollector to a JSON file. This data has all the method calls from the Twig templates to entities / methods.
Then, when normally running PHPStan on the whole project, we could include the data from JSON with the other MethodCallCollector.
Now, dead-code-detector has a full picture about calls in PHP and in Twig.
The downside of this approach is obviously that the dead-code-detector extension has a dependency on the TwigStan run.
But I think it could be fine to only run dead-code-detector on CI, after TwigStan was completed.
The text was updated successfully, but these errors were encountered: