定制 serendipity_hq/rector-config 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

serendipity_hq/rector-config

最新稳定版本:1.1.14

Composer 安装命令:

composer require serendipity_hq/rector-config

包简介

Custom configuration for Rector used by Serendipity HQ.

关键字:

README 文档

README

Serendipity HQ Rector Configuration

A predefined configuration used in Serendipity HQ's projects.

Current Status

Phan PHPStan PSalm PHPUnit Composer PHP CS Fixer Rector

Do you like this library?
LEAVE A ★

or run
composer global require symfony/thanks && composer thanks
to say thank you to all libraries you use in your current project, this included!

Install monolog-html-line-formatter via Composer

$ composer require serendipity_hq/rector-config

This library follows the http://semver.org/ versioning conventions.

How to use Serendipity HQ Rector Config

<?php

declare(strict_types = 1);

use SerendipityHQ\Integration\Rector\SerendipityHQ;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Rector\Core\Configuration\Option;
use Rector\Core\ValueObject\PhpVersion;

return static function (ContainerConfigurator $containerConfigurator) : void {
    $parameters = $containerConfigurator->parameters();

    $parameters->set(Option::PHP_VERSION_FEATURES, PhpVersion::PHP_81);
    $parameters->set(Option::PATHS, [__DIR__ . '/src', __DIR__ . '/tests']);
    $parameters->set(Option::BOOTSTRAP_FILES, [__DIR__ . '/vendor-bin/phpunit/vendor/autoload.php']);

    // Import directly the configuration from Serendipity HQ Rector Config
    $containerConfigurator->import(SerendipityHQ::SHQ_SYMFONY_APP);

    // Import the excluded rectors
    $toSkip = SerendipityHQ::buildToSkip(SerendipityHQ::SHQ_SYMFONY_APP_SKIP);
    
    // Set the rectors to exclude
    $parameters->set(Option::SKIP, $toSkip);
};

The method SerendipityHQ::buildToSkip() is variadic: it accepts as many arrays as you need.

Use it to exclude the rectors you don't want to be applied in your project.

If you want to exclude other rectors other than the ones excluded by the predefined config, simply create an array in your rector.php configuration file and pass it to SerendipityHQ::buildToSkip():

<?php

declare(strict_types = 1);

use SerendipityHQ\Integration\Rector\SerendipityHQ;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Rector\Core\Configuration\Option;
use Rector\Core\ValueObject\PhpVersion;

return static function (ContainerConfigurator $containerConfigurator) : void {
    ...
    
    $othersToSkip = [
        \Rector\To\Exclude\Rector::class
    ];

    // Import the excluded rectors
    $toSkip = SerendipityHQ::buildToSkip(SerendipityHQ::SHQ_SYMFONY_APP_SKIP, $othersToSkip);
    
    // Set the rectors to exclude
    $parameters->set(Option::SKIP, $toSkip);
};

Do you like this library?
LEAVE A ★

or run
composer global require symfony/thanks && composer thanks
to say thank you to all libraries you use in your current project, this included!

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-01-14