dflydev/php-coding-standards

此仓库包含Dragonfly团队使用的编码规范。

dev-main / 0.0.x-dev 2024-07-23 23:38 UTC

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;