dflydev / php-coding-standards
此仓库包含Dragonfly团队使用的编码规范。
dev-main / 0.0.x-dev
2024-07-23 23:38 UTC
Requires
- php: ~8.0.0 || ~8.1.0 || ~8.2.0
- ext-filter: *
- ergebnis/php-cs-fixer-config: ^5.5
- friendsofphp/php-cs-fixer: ~3.16.0
Requires (Dev)
- ergebnis/composer-normalize: ^2.30.2
- ergebnis/license: ^2.1
This package is auto-updated.
Last update: 2024-08-23 23:52:58 UTC
README
用法
composer require dflydev/php-coding-standards
创建一个新的.php-cs-fixer.dist.php
文件,并在其中添加以下内容
use Ergebnis\PhpCsFixer\Config; $config = Config\Factory::fromRuleSet(new Dflydev\PhpCsFixer\Config\RuleSet\Dflydev()); $config->getFinder()->in(__DIR__); $config->setCacheFile(__DIR__ . '/.php-cs-fixer.cache'); return $config;
带有覆盖规则的配置
💡 可选地,通过传递一个要合并的规则数组来覆盖规则集的规则
use Ergebnis\PhpCsFixer\Config; $config = Config\Factory::fromRuleSet(new Dflydev\PhpCsFixer\Config\RuleSet\Dflydev(), [ 'mb_str_functions' => false, 'strict_comparison' => false, ]); $config->getFinder()->in(__DIR__); $config->setCacheFile(__DIR__ . '/.php-cs-fixer.cache'); return $config;