Skip to content

Commit 153540b

Browse files
Merge branch '6.1' into 6.2
* 6.1: [Messenger] cs fix [Messenger] Fix time-limit check exception [Console] Fix console `ProgressBar::override()` after manual `ProgressBar::cleanup()` [FrameworkBundle] typo default_lifetime example [HttpClient] Handle Amp HTTP client v5 incompatibility gracefully [HttpKernel] Don’t try to wire Response argument with controller.service_arguments [PhpUnitBridge] Fix language deprecations incorrectly marked as direct [FrameworkBundle] Removed unused $willBeAvailable params on Configuration [Cache] Remove extra type condition in MemcachedAdapter::createConnection() Tell about messenger:consume invalid limit options [Messenger] Do not throw 'no handlers' exception when skipping due to duplicate handling
2 parents 46acae9 + b7374c1 commit 153540b

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

AmpHttpClient.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Amp\Http\Client\PooledHttpClient;
1818
use Amp\Http\Client\Request;
1919
use Amp\Http\Tunnel\Http1TunnelConnector;
20+
use Amp\Promise;
2021
use Psr\Log\LoggerAwareInterface;
2122
use Psr\Log\LoggerAwareTrait;
2223
use Symfony\Component\HttpClient\Exception\TransportException;
@@ -29,7 +30,11 @@
2930
use Symfony\Contracts\Service\ResetInterface;
3031

3132
if (!interface_exists(DelegateHttpClient::class)) {
32-
throw new \LogicException('You cannot use "Symfony\Component\HttpClient\AmpHttpClient" as the "amphp/http-client" package is not installed. Try running "composer require amphp/http-client".');
33+
throw new \LogicException('You cannot use "Symfony\Component\HttpClient\AmpHttpClient" as the "amphp/http-client" package is not installed. Try running "composer require amphp/http-client:^4.2.1".');
34+
}
35+
36+
if (!interface_exists(Promise::class)) {
37+
throw new \LogicException('You cannot use "Symfony\Component\HttpClient\AmpHttpClient" as the installed "amphp/http-client" is not compatible with this version of "symfony/http-client". Try downgrading "amphp/http-client" to "^4.2.1".');
3338
}
3439

3540
/**

HttpClient.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\HttpClient;
1313

1414
use Amp\Http\Client\Connection\ConnectionLimitingPool;
15+
use Amp\Promise;
1516
use Symfony\Contracts\HttpClient\HttpClientInterface;
1617

1718
/**
@@ -30,7 +31,7 @@ final class HttpClient
3031
*/
3132
public static function create(array $defaultOptions = [], int $maxHostConnections = 6, int $maxPendingPushes = 50): HttpClientInterface
3233
{
33-
if ($amp = class_exists(ConnectionLimitingPool::class)) {
34+
if ($amp = class_exists(ConnectionLimitingPool::class) && interface_exists(Promise::class)) {
3435
if (!\extension_loaded('curl')) {
3536
return new AmpHttpClient($defaultOptions, null, $maxHostConnections, $maxPendingPushes);
3637
}
@@ -61,7 +62,7 @@ public static function create(array $defaultOptions = [], int $maxHostConnection
6162
return new AmpHttpClient($defaultOptions, null, $maxHostConnections, $maxPendingPushes);
6263
}
6364

64-
@trigger_error((\extension_loaded('curl') ? 'Upgrade' : 'Install').' the curl extension or run "composer require amphp/http-client" to perform async HTTP operations, including full HTTP/2 support', \E_USER_NOTICE);
65+
@trigger_error((\extension_loaded('curl') ? 'Upgrade' : 'Install').' the curl extension or run "composer require amphp/http-client:^4.2.1" to perform async HTTP operations, including full HTTP/2 support', \E_USER_NOTICE);
6566

6667
return new NativeHttpClient($defaultOptions, $maxHostConnections);
6768
}

0 commit comments

Comments
 (0)