pj/configured-php-cs-fixer

PHP Coding Standards Fixer 的配置。

1.0.0 2022-05-08 08:56 UTC

This package is auto-updated.

Last update: 2024-09-08 13:59:27 UTC


README

  • 执行命令 composer require --dev pj/configured-php-cs-fixer
  • 在项目主目录中创建一个名为 .php-cs-fixer.dist.php 的文件,并包含以下内容(根据项目进行调整)
<?php
declare(strict_types=1);

use PhpCsFixer\Finder;
use PJ\PhpCsFixer\Config;

$finder = Finder::create()
	->in(__DIR__)
	->ignoreUnreadableDirs(true)
	->ignoreVCSIgnored(true)
	->exclude('config/secrets');

return Config::get()
	->setFinder($finder);
  • 将条目添加到 composer.json
"scripts": {
	"fix-cs": "./vendor/bin/php-cs-fixer fix -v"
}
  • .php-cs-fixer.cache 文件添加到 .gitignore 文件中。