|
13 | 13 |
|
14 | 14 | use Composer\InstalledVersions;
|
15 | 15 | use Doctrine\Common\Annotations\Reader;
|
| 16 | +use Http\Client\HttpAsyncClient; |
16 | 17 | use Http\Client\HttpClient;
|
17 | 18 | use phpDocumentor\Reflection\DocBlockFactoryInterface;
|
18 | 19 | use phpDocumentor\Reflection\Types\ContextFactory;
|
@@ -2354,8 +2355,9 @@ private function registerHttpClientConfiguration(array $config, ContainerBuilder
|
2354 | 2355 | $container->removeAlias(ClientInterface::class);
|
2355 | 2356 | }
|
2356 | 2357 |
|
2357 |
| - if (!ContainerBuilder::willBeAvailable('php-http/httplug', HttpClient::class, ['symfony/framework-bundle', 'symfony/http-client'])) { |
2358 |
| - $container->removeDefinition(HttpClient::class); |
| 2358 | + if (!$hasHttplug = ContainerBuilder::willBeAvailable('php-http/httplug', HttpAsyncClient::class, ['symfony/framework-bundle', 'symfony/http-client'])) { |
| 2359 | + $container->removeDefinition(HttpAsyncClient::class); |
| 2360 | + $container->removeAlias(HttpClient::class); |
2359 | 2361 | }
|
2360 | 2362 |
|
2361 | 2363 | if ($this->readConfigEnabled('http_client.retry_failed', $container, $retryOptions)) {
|
@@ -2425,6 +2427,13 @@ private function registerHttpClientConfiguration(array $config, ContainerBuilder
|
2425 | 2427 |
|
2426 | 2428 | $container->registerAliasForArgument('psr18.'.$name, ClientInterface::class, $name);
|
2427 | 2429 | }
|
| 2430 | + |
| 2431 | + if ($hasHttplug) { |
| 2432 | + $container->setDefinition('httplug.'.$name, new ChildDefinition(HttpAsyncClient::class)) |
| 2433 | + ->replaceArgument(0, new Reference($name)); |
| 2434 | + |
| 2435 | + $container->registerAliasForArgument('httplug.'.$name, ClientInterface::class, $name); |
| 2436 | + } |
2428 | 2437 | }
|
2429 | 2438 |
|
2430 | 2439 | if ($responseFactoryId = $config['mock_response_factory'] ?? null) {
|
|
0 commit comments