mapado / php-cs-fixer-config
Mapado PHP CS Fixer 配置
v4.1.0
2024-08-29 12:56 UTC
Requires
- friendsofphp/php-cs-fixer: ^3.60
Requires (Dev)
- phpunit/phpunit: ^10.3
README
Mapado 的 PHP CS Fixer
配置。
安装
$ composer require --dev mapado/php-cs-fixer-config
使用方法
配置
在项目根目录下创建配置文件 .php_cs
<?php require(__DIR__ .'/vendor/autoload.php'); $config = new \Mapado\CS\Config(); $config->getFinder() ->in([ __DIR__.'/src', ]) // if you want to exclude Tests directory // ->exclude([ 'Tests' ]) ; return $config;
运行
bin/php-cs-fixer fix --config=.php_cs
在项目中
您可能想要使用 lint-staged、php-git-hooks 或 composer-git-hooks 来在 git 文件上自动运行此命令,或在 IDE 中自动修复。
Git
将 .php_cs.cache
(这是由 php-cs-fixer
创建的缓存文件)添加到 .gitignore
许可
本项目采用 MIT 许可协议。