editions-tissot/php-cs-fixer-config

v3.0.0 2024-02-23 15:38 UTC

This package is not auto-updated.

Last update: 2024-09-20 18:34:24 UTC


README

PHP CS Fixer 配置用于 Editions Tissot 组件。

安装

运行

$ composer require --dev editions-tissot/php-cs-fixer-config

使用

配置

在项目的根目录下创建一个配置文件 .php-cs-fixer.dist.php

<?php

$config = new EditionsTissot\CS\Config\Config;
$config->getFinder()
    ->in(
        [
            __DIR__.'/src',
            __DIR__.'/tests',
        ]
    );

return $config;

Git

.php-cs-fixer.cache(这是由 php-cs-fixer 创建的缓存文件)添加到 .gitignore

vendor/
.php-cs-fixer.cache

Makefile

创建一个包含以下目标的 Makefile

# 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

修复问题

手动

如果您需要在本地上检查问题,只需运行

$ make cs

如果您需要在本地上修复问题,只需运行

$ make cs-fix

在您的持续集成中运行

$ make cs-ci

致谢

Editions Tissot 开发,灵感来自 Rémy BRUYERE (rem42)

许可

本项目受 MIT 许可 许可。