jreklund/php-cs-fixer-compat 问题修复 & 功能扩展

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

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

jreklund/php-cs-fixer-compat

最新稳定版本:v1.0.2

Composer 安装命令:

composer require jreklund/php-cs-fixer-compat

包简介

Compatibility layer for older rules that have changed

README 文档

README

Use older versions of rules in PHP-CS-Fixer v3.61.1 (or newer?).

Installation

composer require --dev jreklund/php-cs-fixer-compat

Requirements

You must install either friendsofphp/php-cs-fixer or php-cs-fixer/shim (recommended) for this package to work.

composer require --dev friendsofphp/php-cs-fixer
composer require --dev php-cs-fixer/shim

Usage

$config = new PhpCsFixer\Config();

return $config
    ->registerCustomFixers([
        new PhpCsFixerCompat\Fixer\Basic\BracesFixer380(),
    ])
    ->setRules([
        '@PER' => true,
        'control_structure_braces' => false,
        'control_structure_continuation_position' => false,
        'braces_position' => false,
        'no_multiple_statements_per_line' => false,
        'statement_indentation' => false,
        'PhpCsFixerCompat/braces_380' => true,
    ])
    ->setFinder(
        PhpCsFixer\Finder::create()
        ->exclude('vendor')
        ->in(__DIR__)
    );

PHP-CS-Fixer/shim

⚠️ Depending on how PHP-CS-Fixer/shim gets executed, you may need to manually load bootstrap.php by requiring it in your .php-cs-fixer.php.

$compatPath = implode(DIRECTORY_SEPARATOR, [
    __DIR__,
    'vendor',
    'jreklund',
    'php-cs-fixer-compat',
]);

$bootstrap = $compatPath . DIRECTORY_SEPARATOR . 'bootstrap.php';

if (file_exists($bootstrap)) {
    require $bootstrap;
}

// config starts here

Rules

All compat rules follow the same naming scheme: PhpCsFixerCompat/{rule}_{version}.

All fixers can be found under the namespace: PhpCsFixerCompat\Fixer\{custom-fixer}.

Rule Version Compat Rule Custom Fixer
braces 3.8.0 braces_380 Basic\BracesFixer380

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-02-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固