PHPStan Plugin is an extension for the popular static analysis tool PHPStan. Its suppose to be a plug & play extension, no need for any complex setup or configuration.
Instead of having to manually install PHPStan and run it on your project everytime you make a change, this extension runs PHPStan behind the scenes automatically. It outputs the errors and displays them in your file. It also display a statusbar with a summary. This in theory, should result in faster workflows.
This is NOT an official extension from PHPStan, its more of a passion/learning project made by me because I was bored ¯\_(ツ)_/¯
.
- Runs PHPStan analysis in the background providing errors and diganostics.
You might be wondering why use this at all? one can use other extensions that behave like actual language analyzers / lsps. Providing not only errors but also autocompletion and documentation.
Well, you are probably right, this is a very niche extension and made solely for learning purposes.
Moreover, I found it later that are already extensions that do the same thing and maybe even better. Check them out!
- PHP minimum version 7.2.0 is required and need to be avaialble globally to run PHPStan.
- Check out PHP Install for help downloading php.
- This document may be out of date. Check the official PHPStan Documentation.
-
php-stan.binary
: PHPStan binary approach that gets executed. Only Phar files are supported for now, later on composer support will be added. -
php-stan.level
: PHPStan Analysis Level. This is the level used for analysis. Possible value are from 0-9 inclusive. By default its set to 5. -
php-stan.analysisOn
: Determines the trigger for running the analysis, By default its set toonSave
but it can be changed toonChange
ormanual
. -
php-stan.analysisScope
: Determines the files that are analysed with each trigger, By default its set todirectory
but it can be changed tofile
orworkspace
.
This extension is still a work in progress, errors may and will occur.
- PHPStan errors will always appear in the beginning of the line that contains the error, regardless of where the actual error is. As a result, error messages are not always accurate.
- Initial release of PHPStanExtension.
- Composer & Extensions Support.
- Setting to specify php binary.
- Maybe add additional commands, clear cache, clear analysis, analyse path, ..
- Possible and specific configurations for phpStan itself?
- Add unit tests.