wpdesk/phpstan-rules
最新稳定版本:1.2.1
Composer 安装命令:
composer require wpdesk/phpstan-rules
包简介
Meta package with PHPStan configuration for WP Desk projects
README 文档
README
This meta-package contains PHPStan configuration for WP Desk projects. This includes dependent extensions like szepeviktor/phpstan-wordpress, and additional, default configuration like inclusion of WooCommerce stubs.
Installation
composer require wpdesk/phpstan-rules Usage
After installation, you can simply use PHPStan in your project without the need to further configuration. Nevertheless, as project grows, it's worth to add even the basic one.
To run PHPStan, simply execute the following command (<path> is only required if not present in configuration file):
vendor/bin/phpstan analyse <path> Dependencies between plugins
Besides WordPress and WooCommerce, it may be sometimes necessary to analyse dependencies between plugins, e.g. when developing an extension to base plugin, PHPStan needs to be aware of the dependent plugin's codebase.
In such cases it is necessary to generate the stubs for the dependent plugin with the use of stub generator library. Try to install it as system-wide utility, rather than plugin's package.
composer global require php-stubs/generator With the aid of this library, you will be able to provide read-only access to the dependent codebase for PHPStan purposes. Use stub extension to ignore this file by your editor analyzers.
generate-stubs --out=/path/to/.stubs/dependency.stub -- /path/to/dependency/src Remember to regenerate the stubs, whenever there's an important change in upstream plugin.
Finally, include generated stubs in your PHPStan configuration.
parameters: scanFiles: - .stubs/dependency.stub 统计信息
- 总下载量: 5.91k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 13
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-04