承接 chieftools/php-cs-fixer 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

chieftools/php-cs-fixer

最新稳定版本:v1.0.4

Composer 安装命令:

composer require chieftools/php-cs-fixer

包简介

Opinionated PHP CS Fixer configuration for Chief Tools projects.

README 文档

README

Total Downloads Monthly Downloads Latest Stable Version License

Opinionated PHP CS Fixer configuration for Chief Tools projects.

Installation

Install the package as a development dependency:

composer require --dev chieftools/php-cs-fixer

Allow the Composer plugin so the shared .editorconfig can be copied to your project:

{
    "config": {
        "allow-plugins": {
            "chieftools/php-cs-fixer": true
        }
    }
}

Create a .php-cs-fixer.php file in your project:

<?php

$finder = PhpCsFixer\Finder::create()
    ->in(__DIR__ . '/app')
    ->in(__DIR__ . '/tests')
    ->in(__DIR__ . '/config')
    ->in(__DIR__ . '/routes')
    ->in(__DIR__ . '/database')
    ->name('*.php')
    ->ignoreDotFiles(true)
    ->ignoreVCS(true);

return ChiefTools\PhpCsFixer\Config::make($finder);

Custom project rules

Project rules may be merged on top of the Chief Tools defaults:

return ChiefTools\PhpCsFixer\Config::make($finder, [
    'yoda_style'      => true,
    'ordered_imports' => [
        'sort_algorithm' => 'alpha',
    ],
]);

EditorConfig

This package contains the canonical Chief Tools .editorconfig in the package root. When the Composer plugin is allowed, it copies that file into the consuming project on install and update.

The plugin:

  • creates .editorconfig when missing
  • skips it when it already matches the package version
  • overwrites it when it differs from the package version

If plugins are disabled, copy it manually from:

vendor/chieftools/php-cs-fixer/.editorconfig

Custom rules

ChiefTools/phpdoc_fqcn

This rule expands imported class names inside PHPDoc annotations:

  use App\Models\User;
  use Illuminate\Database\Eloquent\Relations\HasMany;

- /** @return HasMany<Domain> */
+ /** @return \Illuminate\Database\Eloquent\Relations\HasMany<\App\Models\Domain> */

Executable PHP type hints may still use normal imports.

ChiefTools/binary_operator_alignment

This rule keeps contiguous assignment and array-pair operators minimally aligned, while blank lines split alignment groups:

- $data      = [];
- $otherDate = $date
+ $data       = [];
+ $otherDate  = $date
      ->addDays(5);
  $commonDate = now();

ChiefTools/nested_method_chaining_indentation

This rule keeps nested argument method chains aligned with the first object operator on the expression line:

  return wrap(
      $service->items()
-         ->filter()
+             ->filter()
  );

Statement-level chains still use PHP CS Fixer's regular method_chaining_indentation behavior.

统计信息

  • 总下载量: 629
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固