glen / php-cs-fixer-config
提供 php-cs-fixer 的配置
0.3.0
2020-04-26 08:36 UTC
Requires
- php: ^5.3 || ^7.0
- ext-json: *
Requires (Dev)
- composer/semver: ^1.0
- friendsofphp/php-cs-fixer: ^2.0
- phpunit/phpunit: ^4.8.36
- symfony/process: ^2.7 || ^3.0 || ^4.0
README
为 friendsofphp/php-cs-fixer 提供默认配置和配置构建器。
执行以下操作
- Filter\GitFilter: 配置仅接受 Git 中存在的文件
- Filter\DefaultFilter: 配置将
.php_cs
包含在文件集中 - Rules\DefaultRules: 应用基于 @Symfony 规则的规则集
- Rules\PlatformRules: 启用依赖于 PHP 版本的额外规则
PHP 版本由以下方式确定
- 从
composer.lock
读取(如果文件存在)"platform-overrides": { "php": "5.6.0" }
- 从
composer.json:
读取"config": { "platform": { "php": "5.6.0" } }
安装
运行
$ composer require --dev glen/php-cs-fixer-config
用法
配置
在项目的根目录中创建配置文件 .php_cs
<?php // vim:ft=php /** @var \glen\PhpCsFixerConfig\Config $config */ $config = require __DIR__ . '/vendor/glen/php-cs-fixer-config/phpcs.php'; $rules = $config->getRuleBuilder(); $rules['indentation_type'] = false; $rules['class_definition'] = false; return $config;
许可证
本软件包使用 MIT 许可证授权。
致谢
本项目 README 受 localheinz/php-cs-fixer-config 启发。