PHPStan/configuration

From Freephile Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Here is a configuration I used during a quality audit for a large installed base of extensions

sample configuration for testing many extensions

parameters:
# should make regular 'table' output also include clickable links for VSCode
	editorUrl: 'vscode://file/%%file%%:%%line%%'
# should output a title to the link that you can copy/paste to your editor 
	editorUrlTitle: '%%relFile%%:%%line%%'
#	phpVersion: 70400 # PHP 7.4
## Target a particular PHP version for compliance (really only works if your analysis is running that version)
	phpVersion: 80100 # PHP 8.1
	level: 5
	paths:
	- extensions/Arrays #4 (unknown class ExtRegexFun)

	scanDirectories:
	- includes
	- languages
	- maintenance
	- mw-config
	- resources
	- vendor
	- tests/common
	- tests/parser
	- tests/phpunit/mocks
	excludePaths:
		analyse:
			- vendor
			- *Factory*
			- */lib/*
	ignoreErrors:
		# - '#.+ no value type specified in iterable type .+#'
		- '#ExtRegexFun#'
		# - '#Constant [a-zA-Z0-9\\_]+ not found#'


PHPStan offers many 'output formats' (and you can write your own too). The 'raw' format is probably most like what you get from Phan