whatwedo/php-coding-standard
最新稳定版本:v1.3.1
Composer 安装命令:
composer require whatwedo/php-coding-standard
包简介
Default PHP coding standard at whatwedo
README 文档
README
PhpCodingStandard
This project is a set of coding standard rules, which we are using at whatwedo. It's heavily based on Simplify/EasyCodingStandard.
Installation
We suggest to use Composer to install this project:
composer require whatwedo/php-coding-standard
Usage
Without custom configuration
You can run the checks without project specific configuration using one of following commands:
vendor/bin/ecs check SRC_DIRECTORY --config vendor/whatwedo/php-coding-standard/config/whatwedo-symfony.php # Symfony projects
vendor/bin/ecs check SRC_DIRECTORY --config vendor/whatwedo/php-coding-standard/config/whatwedo-wordpress.php # WordPress projects
vendor/bin/ecs check SRC_DIRECTORY --config vendor/whatwedo/php-coding-standard/config/whatwedo-common.php # Common PHP projects
With custom configuration
If you want to add additional checkers or exclude files, you have to create an ecs.php file in your own project root directory.
<?php declare(strict_types=1); use Symplify\EasyCodingStandard\Config\ECSConfig; return static function (ECSConfig $ecsConfig): void { /* // Remove rules with $ecsConfig->skip() $ecsConfig->skip([ SlevomatCodingStandard\Sniffs\Variables\UnusedVariableSniff::class => null, // Explicitly remove some rules in a specific files PhpCsFixer\Fixer\FunctionNotation\MethodArgumentSpaceFixer::class => [ __DIR__ . '/PATH/FILE.php' ], ]); */ // This need to come last $ecsConfig->sets([__DIR__ . '/vendor/whatwedo/php-coding-standard/config/whatwedo-common.php']); };
Then run the following command:
vendor/bin/ecs check SRC_DIRECTORY
To fix certain issues automatically add --fix add the end
For other configuration options, check out Simplify/EasyCodingStandard.
Dependencies
- PHP >=7.4
- Simplify/EasyCodingStandard
- kubawerlos/php-cs-fixer-custom-fixers
- slevomat/coding-standard
License
This bundle is under the MIT license. See the complete license in the bundle: LICENSE
统计信息
- 总下载量: 34.44k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 1
- 依赖项目数: 12
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-09-25