fsevestre / php-cs-fixer-config
PHP CS Fixer 配置
v1.0.0
2018-04-21 16:38 UTC
Requires
- friendsofphp/php-cs-fixer: ^2.10
This package is auto-updated.
Last update: 2024-09-15 01:26:06 UTC
README
PHP CS Fixer 配置。
安装
运行
$ composer require --dev fsevestre/php-cs-fixer-config
使用
配置
在项目根目录下创建一个 .php_cs 配置文件
<?php $config = new FSevestre\CS\Config\PhpXX(); $config->getFinder() ->in([ __DIR__.'/src' ])->exclude([ 'tests' ]) ; return $config;
Git
将 .php_cs.cache(这是由 php-cs-fixer 创建的缓存文件)添加到 .gitignore
vendor/
.php_cs.cache
Makefile
创建一个包含以下目标的 Makefile
# Coding Style cs: ./vendor/bin/php-cs-fixer fix --dry-run --stop-on-violation --diff cs-fix: ./vendor/bin/php-cs-fixer fix --verbose cs-ci: ./vendor/bin/php-cs-fixer fix --dry-run --using-cache=no --verbose --show-progress=estimating
修复问题
如果您需要在本地上 检查 问题,请运行
$ make cs
如果您需要在本地上 修复 问题,请运行
$ make cs-fix
在您的持续集成中,运行
$ make cs-ci
鸣谢
灵感来源于 m6web/php-cs-fixer-config。
许可证
本项目采用 MIT 许可证。