-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpClient] Handle Amp HTTP client v5 incompatibility gracefully #48173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[HttpClient] Handle Amp HTTP client v5 incompatibility gracefully #48173
Conversation
@@ -30,7 +31,7 @@ final class HttpClient | |||
*/ | |||
public static function create(array $defaultOptions = [], int $maxHostConnections = 6, int $maxPendingPushes = 50): HttpClientInterface | |||
{ | |||
if ($amp = class_exists(ConnectionLimitingPool::class)) { | |||
if ($amp = class_exists(ConnectionLimitingPool::class) && interface_exists(Promise::class)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively, we could check 1 class/interface that exists in v4 and not in v5 here instead of having 2 checks. But I followed @kelunik (maintainer of amphp) suggestion of using this core amphp interface (http client v4 requires core v2 that has this interface, http client v5 requires core v3 that doesn't have this interface).
b2e3f0f
to
7192c33
Compare
Thank you @fancyweb. |
There didn't need to be any tests for this? |
We would have to make a special CI job that changes the dev requirement to install a different version and run a different test. That's quite hard to bring in our testsuite |
I thought you might have a solution for it already, considering that even before this change, there is still the requirement to be able to test library switching and fallback. |
symfony/http-client
is not compatible withamphp/http-client ^5
.Currently, various class not found errors are thrown (classes that we use and that existed in v4 and that don't exist in v5).