moderntribe/coding-standards
最新稳定版本:v3.3.0
Composer 安装命令:
composer require --dev moderntribe/coding-standards
包简介
The Modern Tribe Coding Standard for PHPCS
关键字:
README 文档
README
The Modern Tribe Coding Standard is a set of PHP_CodeSniffer rules for use primarily with the SquareOne framework.
Requirements
- PHP ^8.0
Install
Composer v2:
composer require --dev moderntribe/coding-standards "^3.0"`
Composer v1:
Add to the repositories object:
{
"type": "vcs",
"url": "git@github.com:moderntribe/coding-standards.git"
}
And require-dev:
"moderntribe/coding-standards": "^3.0"
Project ruleset
Ensure you're running PHP 8.0 locally!
To use this ruleset, create a phpcs.xml.dist in the root of the project and add the following content:
<?xml version="1.0"?> <ruleset> <arg name="basepath" value="." /> <arg name="extensions" value="php" /> <arg name="severity" value="4" /> <arg name="tab-width" value="4" /> <arg name="parallel" value="80" /> <arg name="colors" /> <!-- Update to the PHP version your production/local docker container runs on --> <config name="testVersion" value="8.0" /> <!-- php -r 'echo PHP_VERSION_ID;' --> <config name="php_version" value="80022" /> <!-- Fix WordPress's terrible typing breaking PHPCS --> <config name="minimum_supported_wp_version" value="5.6.0" /> <!-- Ignore warnings, show progress of the run and show sniff names --> <arg value="nps" /> <!-- Directories to be checked --> <file>./wp-content/plugins/core</file> <file>./wp-content/themes/core</file> <file>./wp-content/mu-plugins</file> <!-- Exclude files --> <exclude-pattern>*-config.php</exclude-pattern> <exclude-pattern>*vendor/</exclude-pattern> <exclude-pattern>*tests/*</exclude-pattern> <exclude-pattern>*.twig</exclude-pattern> <exclude-pattern>*webpack/</exclude-pattern> <!-- Include the Modern Tribe coding standard --> <rule ref="ModernTribe" /> </ruleset>
Add
phpcs.xmlto your.gitignore
Manual Usage
PHPCS
./vendor/bin/phpcs --standard=ModernTribe /path/to/files/**.php
PHPCBF
./vendor/bin/phpcbf --standard=ModernTribe /path/to/files/**.php
Resources:
统计信息
- 总下载量: 34.84k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 9
- 点击次数: 1
- 依赖项目数: 7
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-05-21