janaseta/php-cs
最新稳定版本:1.2.0
Composer 安装命令:
composer require janaseta/php-cs
包简介
Jāņa sēta's php-cs-fixer config
README 文档
README
Jāņa sēta's php-cs-fixer config
Installation & setup
Add package to dev dependencies:
composer require janaseta/php-cs --dev
Create a .php-cs-fixer.dist.php file that instructs fixer to work in the
directories where you need it:
<?php return JanaSeta\PhpCs\Fix::in([ // List directories where your PHP is 'src', ]);
Usage
Dry run:
vendor/bin/php-cs-fixer fix --dry-run --diff
Fix the code style:
vendor/bin/php-cs-fixer fix
Customization
To add or override some rules or rulesets use the addRules method:
/* .php-cs-fixer.dist */ <?php return JanaSeta\PhpCs\Fix::in([ 'src', 'tests', ])->addRules([ 'braces' => true, 'is_null' => false, ]);
If you need to specify some details on the PhpCsFixer instance or a custom
Finder, you can use this package in the following way:
/* .php-cs-fixer.dist */ <?php // Create a Finder instance $finder = PhpCsFixer\Finder::create() ->in($folders); // Search however you need $config = new JanaSeta\PhpCs\Config; return $config ->setIndent(' ') // Set any php-cs-fixer options that you desire ->setFinder($finder);
Tips
Define these scripts in your composer.json:
"scripts": { "fix": "php-cs-fixer fix", "cs": "@fix --dry-run --diff" }
and you'll have composer cs and composer fix commands.
统计信息
- 总下载量: 5.88k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2022-02-14