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

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

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

m6web/php-cs-fixer-config

最新稳定版本:v5.1.0

Composer 安装命令:

composer require m6web/php-cs-fixer-config

包简介

PHP CS Fixer config for M6Web components

README 文档

README

PHP CS Fixer config for M6Web components.

Installation

Run

$ composer require --dev m6web/php-cs-fixer-config

Usage

Configuration

Create a configuration file .php-cs-fixer.dist.php in the root of your project:

<?php

$finder = PhpCsFixer\Finder::create()
    ->in(
        [
            __DIR__.'/src',
            __DIR__.'/tests',
        ]
    );

$config = new M6Web\CS\Config\BedrockStreaming();
$config->setFinder($finder);

return $config;

Custom configuration

You may extend these rules and apply your own extra rules.

Create a configuration file .php-cs-fixer.dist.php in the root of your project:

<?php

$finder = PhpCsFixer\Finder::create()
    ->in([
        __DIR__.'/src',
        __DIR__.'/tests',
    ]);

$config = new class() extends PhpCsFixer\Config {
    public function __construct()
    {
        parent::__construct('customized Bedrock Streaming');
        $this->setRiskyAllowed(true);
    }
    
    public function getRules(): array
    {
        $rules = (new M6Web\CS\Config\BedrockStreaming())->getRules();
        
        // perform updates on the rules array here
        
        return $rules;
    }
};

$config->setFinder($finder);

return $config;

Git

Add .php-cs-fixer.cache (this is the cache file created by php-cs-fixer) to .gitignore:

vendor/
.php-cs-fixer.cache

Makefile

Create a Makefile with the targets below:

# Coding Style

cs:
	./bin/php-cs-fixer fix --dry-run --stop-on-violation --diff

cs-fix:
	./bin/php-cs-fixer fix

cs-ci:
	./bin/php-cs-fixer fix --dry-run --using-cache=no --verbose

Fixing issues

Manually

If you need to check issues locally, just run

$ make cs

If you need to fix issues locally, just run

$ make cs-fix

In your Continuous Integration, run

$ make cs-ci

Credits

Developed by Bedrock Streaming, inspired by refinery29/php-cs-fixer-config.

License

This project is licensed under the MIT license.

统计信息

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

GitHub 信息

  • Stars: 7
  • Watchers: 40
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-05-29