当前位置: 首页 > 工具软件 > PHPStan > 使用案例 >

phpstan 过滤规则ignoreErrors如果正确编写?

穆城
2023-12-01

附上phpstan的git地址:https://github.com/phpstan/phpstan.git

其中对过滤规则描述:

parameters:
	ignoreErrors:
		- '#Call to an undefined method [a-zA-Z0-9\\_]+::method\(\)#'
		- '#Call to an undefined method [a-zA-Z0-9\\_]+::expects\(\)#'
		- '#Access to an undefined property PHPUnit_Framework_MockObject_MockObject::\$[a-zA-Z0-9_]+#'
		- '#Call to an undefined method PHPUnit_Framework_MockObject_MockObject::[a-zA-Z0-9_]+\(\)#'

执行 vendor/bin/phpstan analyse -l 0  -c phpstan.neon /home/www/workspace/test目录,报了大量:

Class  *  was not found while trying to analyse it - autoloading is probably not configured properly.

编辑phpstan.neon文件,添加规则如下:

ignoreErrors:
       - '#Class * was not found while trying to analyse it - autoloading is probably not configured properly.#'

仍然没有生效,怎么解决?

 类似资料: