moderntribe / static-analysis
使用 PHPStan 进行 Modern Tribe 静态分析
dev-main
2022-04-06 23:45 UTC
Requires
This package is auto-updated.
Last update: 2024-09-07 05:12:24 UTC
README
安装
Composer v2
composer require --dev moderntribe/static-analysis
Composer v1
添加到 repositories
对象
{ "type": "vcs", "url": "git@github.com:moderntribe/static-analysis.git" }
以及 require-dev
"moderntribe/static-analysis": "^0.0"
使用方法
要在您的项目上运行静态分析,请在项目根目录中创建名为 phpstan.neon.dist
的文件,并包含以下内容
parameters: level: 2 paths: - wp-content/themes/core/ - wp-content/plugins/core/ - wp-content/mu-plugins/ excludePaths: - vendor bootstrapFiles: - vendor/php-stubs/wordpress-stubs/wordpress-stubs.php - vendor/php-stubs/acf-pro-stubs/acf-pro-stubs.php tmpDir: .phpstan-cache/ ignoreErrors: - '#^Function yoast_get_primary_term_id not found.$#' checkAlwaysTrueStrictComparison: true # Unfortunately, DocBlocks can't be relied upon in WordPress. treatPhpDocTypesAsCertain: false
要在您的项目上运行 phpstan,请在项目根目录中运行 phpstan analyse --configuration=phpstan.neon.dist
更新您的项目 .gitignore 文件
/.phpstan-cache /phpstan.neon