定制 sirix/php-cs-fixer-config 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

sirix/php-cs-fixer-config

Composer 安装命令:

composer require sirix/php-cs-fixer-config

包简介

Sirix PHP coding standards fixer configuration.

README 文档

README

Wrapper with pre-defined rules around the PHP-CS-Fixer package - A tool to automatically fix PHP Coding Standards issues.

Latest Stable Version Total Downloads Latest Unstable Version License PHP Version Require

Installation

Using Composer

The recommended way to install PHP CS Fixer is to use Composer in a dedicated composer.json file in your project, for example in the tools/php-cs-fixer directory:

  1. Create a new tools/php-cs-fixer directory:
mkdir -p tools/php-cs-fixer
  1. Install via composer:
composer req --dev --working-dir=tools/php-cs-fixer sirix/php-cs-fixer-config

Configuration

  1. Create PHP file and name it .php-cs-fixer.dist.php and place it inside root directory of project. It will be recognized by PHP CS Fixer automatically.

  2. Contents of file should look like this:

    <?php
    
    declare(strict_types=1);
    
    use Sirix\CsFixerConfig\ConfigBuilder;
    
    return ConfigBuilder::create()
        ->inDir(__DIR__ . '/src')
        ->inDir(__DIR__ . '/test')
        ->getConfig()
    ;

or, you can add additional rules to the configuration file:

        <?php
        
        declare(strict_types=1);
        
        use Sirix\CsFixerConfig\ConfigBuilder;
        
        return ConfigBuilder::create()
            ->inDir(__DIR__ . '/config')
            ->inDir(__DIR__ . '/src')
            ->inDir(__DIR__ . '/test')
            ->setRules([
                'Gordinskiy/line_length_limit' => ['max_length' => 150],
                '@PHP83Migration' => true,
            ])
            ->getConfig()
        ;
  1. Place .php-cs-fixer.cache file into .gitignore

Usage/Examples

  • Fix coding standards:
$ php tools/php-cs-fixer/vendor/bin/php-cs-fixer fix -v
  • Check coding standards without applying the fix:
$ php tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --dry-run
  • Examine the proposed changes:
$ php tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --dry-run -v --diff

Documentation

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-03-29

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固