2020-07-18 18:57:24 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
2020-10-14 06:24:29 +02:00
|
|
|
use Rector\Defluent\Rector\MethodCall\FluentChainMethodCallToNormalMethodCallRector;
|
2020-07-18 18:57:24 +02:00
|
|
|
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
|
2020-08-25 00:26:14 +02:00
|
|
|
use Rector\Renaming\ValueObject\MethodCallRename;
|
2020-08-30 19:59:59 +02:00
|
|
|
use Rector\Transform\Rector\FuncCall\FuncCallToMethodCallRector;
|
2020-08-30 20:48:37 +02:00
|
|
|
use Rector\Transform\Rector\StaticCall\StaticCallToFuncCallRector;
|
2021-02-09 15:02:29 +01:00
|
|
|
use Rector\Transform\ValueObject\FuncCallToMethodCall;
|
2020-08-30 20:48:37 +02:00
|
|
|
use Rector\Transform\ValueObject\StaticCallToFuncCall;
|
2020-07-18 18:57:24 +02:00
|
|
|
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
2020-11-26 17:44:27 +01:00
|
|
|
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
2020-07-18 18:57:24 +02:00
|
|
|
|
|
|
|
return static function (ContainerConfigurator $containerConfigurator): void {
|
|
|
|
$services = $containerConfigurator->services();
|
|
|
|
|
|
|
|
# both uses "%classes_to_defluent%
|
2020-09-11 11:21:48 +02:00
|
|
|
$services->set(FluentChainMethodCallToNormalMethodCallRector::class);
|
2020-07-18 18:57:24 +02:00
|
|
|
|
2020-08-23 11:39:09 +02:00
|
|
|
$configuration = [
|
2021-02-09 15:02:29 +01:00
|
|
|
new FuncCallToMethodCall('GuzzleHttp\json_decode', 'GuzzleHttp\Utils', 'jsonDecode'),
|
|
|
|
new FuncCallToMethodCall('GuzzleHttp\get_path', 'GuzzleHttp\Utils', 'getPath'),
|
2020-08-23 11:39:09 +02:00
|
|
|
];
|
|
|
|
|
2020-08-04 01:58:03 +02:00
|
|
|
$services->set(FuncCallToMethodCallRector::class)
|
2020-07-30 00:43:06 +02:00
|
|
|
->call('configure', [[
|
2020-11-26 17:44:27 +01:00
|
|
|
FuncCallToMethodCallRector::FUNC_CALL_TO_CLASS_METHOD_CALL => ValueObjectInliner::inline($configuration),
|
2020-07-30 00:43:06 +02:00
|
|
|
]]);
|
2020-07-18 18:57:24 +02:00
|
|
|
|
2020-08-30 20:48:37 +02:00
|
|
|
$services->set(StaticCallToFuncCallRector::class)
|
2020-07-30 00:43:06 +02:00
|
|
|
->call('configure', [[
|
2020-11-26 17:44:27 +01:00
|
|
|
StaticCallToFuncCallRector::STATIC_CALLS_TO_FUNCTIONS => ValueObjectInliner::inline([
|
2020-08-30 20:48:37 +02:00
|
|
|
new StaticCallToFuncCall('GuzzleHttp\Utils', 'setPath', 'GuzzleHttp\set_path'),
|
|
|
|
new StaticCallToFuncCall('GuzzleHttp\Pool', 'batch', 'GuzzleHttp\Pool\batch'),
|
2020-08-26 12:54:53 +02:00
|
|
|
]),
|
2020-07-30 00:43:06 +02:00
|
|
|
]]);
|
2020-07-18 18:57:24 +02:00
|
|
|
|
|
|
|
$services->set(RenameMethodRector::class)
|
2020-07-30 00:43:06 +02:00
|
|
|
->call('configure', [[
|
2020-11-26 17:44:27 +01:00
|
|
|
RenameMethodRector::METHOD_CALL_RENAMES => ValueObjectInliner::inline([
|
2020-08-25 00:26:14 +02:00
|
|
|
new MethodCallRename('GuzzleHttp\Message\MessageInterface', 'getHeaderLines', 'getHeaderAsArray'),
|
|
|
|
]),
|
2020-07-30 00:43:06 +02:00
|
|
|
]]);
|
2020-07-18 18:57:24 +02:00
|
|
|
};
|