先改一下composer.JSON{ "require-dev": { &
先改一下composer.JSON
{
"require-dev": {
"symfony/var-dumper": "^4.2",
"PHPstan/phpstan": "^0.12.33"
},
"autoload": {
"psr-4": {
"app\\": "application"
},
"psr-0": {
"": "extend/"
},
"files": [
"application/common.php",
"vendor/topthink/framework/helper.php"
]
},
"scripts": {
"analyse": "phpstan analyse --memory-limit 2G -c phpstan.neon"
}
}
主要是加一下phpstan包跟analyse脚本
在项目根目录下加一下phpstan.neon文件
# Magic behaviour with __get, __set, __call and __callStatic is not exactly static analyser-friendly :)
# Fortunately, You can inGore it by the following config.
#
# vendor/bin/phpstan analyse app --memory-limit 200M -l 0
#
parameters:
level: 1
paths:
- ./application
ignoreErrors:
# - '#Static call to instance method think\[a-zA-Z0-9\]::[a-zA-Z0-9\\_]+\(\)#'
执行composer update
执行composer analyse
写一个错误试试
如上已经成功扫描出来错误
--结束END--
本文标题: tp5.1配置phpstan详细教程
本文链接: https://lsjlt.com/news/33041.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0