Skip to content

Commit 35afa96

Browse files
committed
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.
1 parent 42eac28 commit 35afa96

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Command/FixerApplication.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,9 @@ private function downloadPhar(
338338
$dnsConfig = new Config();
339339
$dnsConfig->nameservers = $this->dnsServers;
340340

341+
$loop = new StreamSelectLoop();
342+
Loop::set($loop); // required because of the await() call below
343+
341344
$client = new Browser(
342345
new Connector(
343346
[
@@ -347,7 +350,9 @@ private function downloadPhar(
347350
],
348351
'dns' => $dnsConfig,
349352
],
353+
$loop,
350354
),
355+
$loop,
351356
);
352357

353358
/**
@@ -388,7 +393,7 @@ private function downloadPhar(
388393
$this->printDownloadError($output, $e);
389394
});
390395

391-
Loop::run();
396+
$loop->run();
392397

393398
fclose($pharPathResource);
394399

0 commit comments

Comments
 (0)