woocommerce / woocommerce-sniffs
WooCommerce嗅探器
1.0.0
2023-09-29 13:52 UTC
Requires
- php: >=7.0
- dealerdirect/phpcodesniffer-composer-installer: ^1.0.0
- phpcompatibility/phpcompatibility-wp: ^2.1.0
- wp-coding-standards/wpcs: ^3.0.0
README
PHP_CodeSniffer嗅探器的集合,用于WooCommerce。
安装
composer require woocommerce/woocommerce-sniffs
使用方法
命令行
./vendor/bin/phpcs --standard=WooCommerce-Core <file>
配置文件
PHPCS配置文件
<?xml version="1.0"?> <ruleset name="WooCommerce Coding Standards"> <description>My projects ruleset.</description> <!-- Configs --> <config name="minimum_supported_wp_version" value="4.7" /> <config name="testVersion" value="7.2-" /> <!-- Rules --> <rule ref="WooCommerce-Core" /> <rule ref="WordPress.WP.I18n"> <properties> <property name="text_domain" type="array" value="new-text-domain" /> </properties> </rule> <rule ref="PHPCompatibility"> <exclude-pattern>tests/</exclude-pattern> </rule> </ruleset>