hill-98/php-cs-fixer-config

仅是一个 PHP CS Fixer 规则集

1.1.0 2021-06-29 10:25 UTC

This package is auto-updated.

Last update: 2024-09-07 16:03:47 UTC


README

Packagist Version Packagist Downloads MIT PHPUnit Test

基于 PSR12 规则集进行扩展

安装

composer require hill-98/php-cs-fixer-config --dev

您也可以前往最新版本的 发布版本

用法

.php-cs-fixer.php:

<?php

// Allow Risky rules
// const RISKY = true;

$finder = PhpCsFixer\Finder::create()
    ->exclude('somedir')
    ->notPath('src/Symfony/Component/Translation/Tests/fixtures/resources.php')
    ->in(__DIR__);

// These rules will be merged and set ($rules must be array)
$rules = [];

// Extended $config ($config must be \PhpCsFixer\ConfigInterface)
// $config = new PhpCsFixer\Config();

/** @var \PhpCsFixer\Config $config */
$config = require __DIR__.'/vendor/hill-98/php-cs-fixer-config/main.php';

// Auto set $finder ($finder must be iterable)
// $config->setFinder($finder); // Don't repeat SET

return $config;