- Run
composer require nicksdot/phpstan-phpstorm-error-identifiers - Then add the formatter(s) you want to the
servicessection in yourphpstan.neon
- Add the service to
phpstan.neon:
services:
errorFormatter.checkstyle:
class: NickSdot\PhpStanPhpStormErrorIdentifiers\CheckstyleErrorFormatterPhpStormThat's it, PHPStorm will automatically use it. And here is how it looks like:
The output of the PHPStan LLM error formatter is optimised for LLMs, resulting in 40–60% less token usage compared to the default RawErrorFormatter output.
Real-life Example (210 errors):
| Formatter | Token | Characters |
|---|---|---|
| TableErrorFormatter | 11,693 | 132,882 |
| RawErrorFormatter | 9,265 | 35,794 |
| LlmErrorFormatter | 4,316 | 18,245 |
- Add the service to
phpstan.neon:
services:
errorFormatter.llm:
class: NickSdot\PhpStanPhpStormErrorIdentifiers\LlmErrorFormatter- Run PHPStan with the
--error-format=llmflag.
