symplify/symfony-php-config

此包已被弃用且不再维护。作者建议使用 symplify/package-builder 包代替。

轻松处理 Symfony PHP Config 的工具

10.0.24 2022-02-19 17:41 UTC

This package is auto-updated.

Last update: 2022-02-19 19:03:32 UTC


README

轻松处理 Symfony PHP Config 的工具。

阅读 如何在 Symfony PHP Config 中内联值对象 了解更多信息.TagValueNodeReprintTest

1. 安装

composer require symplify/symfony-php-config

2. 使用方法

您想在 Symfony 配置中使用值对象吗?

使用 Symplify\SymfonyPhpConfig\ValueObjectInliner::inline() 方法

use Rector\Generic\Rector\FuncCall\FuncCallToStaticCallRector;
use Rector\Transform\ValueObject\FuncCallToStaticCall;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\SymfonyPhpConfig\ValueObjectInliner;

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

    $services->set(FuncCallToStaticCallRector::class)

        ->call('configure', [[
            FuncCallToStaticCallRector::FUNC_CALLS_TO_STATIC_CALLS => ValueObjectInliner::inline([
                new FuncCallToStaticCall('dump', 'Tracy\Debugger', 'dump'),
                // it handles multiple items without duplicated call
                new FuncCallToStaticCall('d', 'Tracy\Debugger', 'dump'),
                new FuncCallToStaticCall('dd', 'Tracy\Debugger', 'dump'),
            ]),
        ]]);
};