From dc8117dd37c5f0919ddfce8ca6da7acb4682b24f Mon Sep 17 00:00:00 2001 From: Caleb White Date: Mon, 30 Jun 2025 16:03:52 -0500 Subject: [PATCH] fix: explicitly use StreamSelectLoop for Pro download The Pro download kept failing in a Docker container when the `uv` extension was enabled (which set the default global loop to the `ExtUvLoop` instance) with the following error: Connection to tls://fixer-download-api.phpstan.com:443 timed out after 5 seconds (ETIMEDOUT) This can be fixed by explicitly using a `StreamSelectLoop` for the Pro download, which is the same loop that's used everywhere else in the codebase. Note that we have to set this as the global loop because the `await()` function no longer supports passing a loop as an argument. --- src/Command/FixerApplication.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Command/FixerApplication.php b/src/Command/FixerApplication.php index 63e071cdde..b89e02f082 100644 --- a/src/Command/FixerApplication.php +++ b/src/Command/FixerApplication.php @@ -338,6 +338,9 @@ private function downloadPhar( $dnsConfig = new Config(); $dnsConfig->nameservers = $this->dnsServers; + $loop = new StreamSelectLoop(); + Loop::set($loop); // @phpstan-ignore staticMethod.internal (required because of the await() call below) + $client = new Browser( new Connector( [ @@ -347,7 +350,9 @@ private function downloadPhar( ], 'dns' => $dnsConfig, ], + $loop, ), + $loop, ); /** @@ -388,7 +393,7 @@ private function downloadPhar( $this->printDownloadError($output, $e); }); - Loop::run(); + $loop->run(); fclose($pharPathResource);