PHPStan: Difference between revisions
Created page with "https://phpstan.org/ PHPStan seems more polished (perhaps because it's commercial and has a 'pro' version that adds a GUI) whereas phan is the original PHP static analysis to..." |
No edit summary |
||
| Line 1: | Line 1: | ||
https://phpstan.org/ | https://phpstan.org/ | ||
PHPStan seems more polished (perhaps because it's commercial and has a 'pro' version that adds a GUI) whereas phan is the original PHP static analysis tool Rasmus Ledorf uses. | PHPStan seems more polished (perhaps because it's commercial and has a 'pro' version that adds a GUI) whereas [[phan]] is the original PHP static analysis tool Rasmus Ledorf uses. | ||
PHPStan has some very notable projects that integrate it: Symphony, Doctrine, Monolog, and many more. | PHPStan has some very notable projects that integrate it: Symphony, Doctrine, Monolog, and many more. (A common refrain: there are PHPStan integrations for Drupal and Wordpress, but not MediaWiki.) | ||
Adding a configuration file for your MediaWiki extension is straightforward and would look like this:<syntaxhighlight lang="yaml"> | Adding a configuration file for your MediaWiki extension is straightforward and would look like this:<syntaxhighlight lang="yaml"> | ||
| Line 24: | Line 24: | ||
The '''scanDirectories''' are additional paths used to discover symbols, but not analyze for errors. | The '''scanDirectories''' are additional paths used to discover symbols, but not analyze for errors. | ||
== Analyzing a forest == | ==Analyzing a forest== | ||
See [[PHPStan/configuration]] for a sample configuration file used for auditing a large installed base of MediaWiki extensions. | See [[PHPStan/configuration]] for a sample configuration file used for auditing a large installed base of MediaWiki extensions. | ||
== Analyzing in depth == | ==Analyzing in depth== | ||
For an example of best-practices, single extension usage, see [https://github.com/ProfessionalWiki/Maps/blob/ee88211fadb3573b646cce005383450e96c3054e/phpstan.neon the example of Professional Wiki's Maps extension] which illustrates configuration file includes of a 'baseline'; error message suppression; and directory exclusions of problem code. | For an example of best-practices, single extension usage, see [https://github.com/ProfessionalWiki/Maps/blob/ee88211fadb3573b646cce005383450e96c3054e/phpstan.neon the example of Professional Wiki's Maps extension] which illustrates configuration file includes of a 'baseline'; error message suppression; and directory exclusions of problem code. | ||