janaseta/php-cs 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2022-02-14