insiders/php-coding-standards

包含一组PHP-CS-Fixer的规则

v2.0.4 2024-04-11 10:23 UTC

This package is auto-updated.

Last update: 2024-09-11 11:33:56 UTC


README

安装

composer require --dev insiders/php-coding-standards

使用

将名为 .php-cs-fixer.dist.php 的文件放置在项目根目录中,该文件包含以下内容。

<?php

declare(strict_types=1);

use Insiders\PhpCodingStandards\PhpCsFixer\Rules;
use PhpCsFixer\Config;
use PhpCsFixer\Finder;

return (new Config())
    ->setRules(Rules::getRulesForPHP72())
    ->setRiskyAllowed(true)
    ->setFinder(Finder::create()->in(__DIR__))
    ->setCacheFile('.php-cs-fixer.cache');

手动执行

在您的项目目录中运行以下命令以修复所有 .php 文件。

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