Skip to content

fix: explicitly use StreamSelectLoop for Pro download #4077

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

Open
wants to merge 1 commit into
base: 2.1.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/Command/FixerApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,9 @@
$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(
[
Expand All @@ -347,7 +350,9 @@
],
'dns' => $dnsConfig,
],
$loop,
),
$loop,
);

/**
Expand All @@ -355,9 +360,9 @@
*/
$latestInfo = Json::decode((string) await($client->get(sprintf('https://fixer-download-api.phpstan.com/latest?%s', http_build_query(['phpVersion' => PHP_VERSION_ID, 'branch' => $branch]))))->getBody(), Json::FORCE_ARRAY);
if ($currentVersion !== null && $latestInfo['version'] === $currentVersion) {
$this->writeInfoFile($infoPath, $latestInfo['version'], $branch);

Check failure on line 363 in src/Command/FixerApplication.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, windows-latest)

Call to internal static method React\EventLoop\Loop::set() from outside its root namespace React.

Check failure on line 363 in src/Command/FixerApplication.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, ubuntu-latest)

Call to internal static method React\EventLoop\Loop::set() from outside its root namespace React.
$output->writeln('<fg=green>You\'re running the latest PHPStan Pro!</>');
return;

Check failure on line 365 in src/Command/FixerApplication.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, windows-latest)

No error with identifier staticMethod.internal is reported on line 365.

Check failure on line 365 in src/Command/FixerApplication.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, ubuntu-latest)

No error with identifier staticMethod.internal is reported on line 365.
}

$output->writeln('<fg=green>Downloading the latest PHPStan Pro...</>');
Expand Down Expand Up @@ -388,7 +393,7 @@
$this->printDownloadError($output, $e);
});

Loop::run();
$loop->run();

fclose($pharPathResource);

Expand Down
Loading