yutahaga/wpcs-psr2
Composer 安装命令:
composer require yutahaga/wpcs-psr2
包简介
PHP_CodeSniffer ruleset to enforce WordPress & PSR-2 coding conventions
README 文档
README
PHP_CodeSniffer ruleset to enforce WordPress & PSR-2 coding conventions
Introduction
A rule set that combines WordPress Coding Standards and PSR-2. The goal is to reduce the stress on developers by reducing the differences in coding conventions with other PHP applications.
Installation
Automatic install
Add the following scripts in composer.json
{
"scripts": {
"install-codestandards": ["Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin::run"],
"post-install-cmd": ["@install-codestandards"]
}
}
composer require --dev dealerdirect/phpcodesniffer-composer-installer composer require --dev yutahaga/wpcs-psr2
Manually install
composer require --dev yutahaga/wpcs-psr2 phpcs --config-set installed_paths ./vendor/yutahaga/wpcs-psr2,./vendor/wp-coding-standards/wpcs,other-ruleset
Usage
Here is an example of the phpcs.xml
<?xml version="1.0"?> <ruleset name="My Coding Standards"> <description>My Coding Standards extends WordPress-Extra and PSR-2</description> <rule ref="WordPress-PSR2" /> <file>./app</file> <file>./bootstrap</file> <file>./config</file> <file>./functions.php</file> <exclude-pattern>bootstrap/cache/*.php</exclude-pattern> <exclude-pattern>*/*.js</exclude-pattern> <exclude-pattern>*/*.css</exclude-pattern> <exclude-pattern>*/*.xml</exclude-pattern> <exclude-pattern>*/node_modules/*</exclude-pattern> <exclude-pattern>*/vendor/*</exclude-pattern> </ruleset>
统计信息
- 总下载量: 30
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-03-21