Skip to content

phpstan

Scott Dutton edited this page May 24, 2019 · 4 revisions

Notes before use

Phpstan has a levels based system. Using -l 0 (the default) should give a manageable number if errors. If you can use it without diffFilter then that is the better option.

Basic Usage

phpstan analyze src > phpstan.txt || true
./vendor/bin/diffFilter --phpstan diff.txt phpstan.txt

Sometimes the errors reported are not on lines which have been changed, for example changing an interface. the usage of these interfaces are flagged as errors. To resolve this issue you also need to pass the --autoload argument with the location of the autoloader. If passed an autoload file the class will be loaded though reflection and related errors will also be reported.

Clone this wiki locally