serendipity_hq/phpcs-config

为Serendipity HQ使用的PHP CS Fixer的定制配置。

1.2.5 2023-10-07 16:02 UTC

This package is auto-updated.

Last update: 2024-09-07 18:07:54 UTC


README

Serendipity HQ PHP CS Fixer配置

在Serendipity HQ项目中使用的一个预定义配置。

当前状态

Phan PHPStan PSalm PHPUnit Composer PHP CS Fixer

你喜欢这个库吗?
留下一个★

或者运行
composer global require symfony/thanks && composer thanks
以向所有使用在当前项目中的库表示感谢,包括这个库!

通过Composer安装monolog-html-line-formatter

$ composer require serendipity_hq/phpcs-config

此库遵循http://semver.org/版本控制约定。

如何使用Serendipity HQ PHP CS Fixer Config

<?php

// WARNING: This variable is fundamental as the rules array sets the `header_comment` rule and expects the variable exists.
$header = <<<EOF
This file is part of the Serendipity HQ PHP CS Fixer Config.

Copyright (c) Adamo Aerendir Crespi <aerendir@serendipityhq.com>.

For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
EOF;

$rules = include \SerendipityHQ\Integration\PhpCsFixer\SerendipityHQ::SHQ_LIBRARY;

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

$config = new PhpCsFixer\Config();
return $config
    ->setFinder($finder)
    ->setUsingCache(true)
    ->setCacheFile(__DIR__.'/var/cache/.php_cs.cache')
    ->setRiskyAllowed(true)
    ->setRules($rules);

要按项目更改规则或它们的配置,只需编辑$rule变量,然后将其传递给Config::setRules()方法。

你喜欢这个库吗?
留下一个★

或者运行
composer global require symfony/thanks && composer thanks
以向所有使用在当前项目中的库表示感谢,包括这个库!