From 9145fbca37aaeee778323370c87a16ebf43d90f6 Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Mon, 21 Oct 2024 15:07:34 +0200 Subject: [PATCH] Assert assumptions --- src/TextUI/Command/Commands/VersionCheckCommand.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/TextUI/Command/Commands/VersionCheckCommand.php b/src/TextUI/Command/Commands/VersionCheckCommand.php index 938cc8d7872..95dabba8cba 100644 --- a/src/TextUI/Command/Commands/VersionCheckCommand.php +++ b/src/TextUI/Command/Commands/VersionCheckCommand.php @@ -10,6 +10,7 @@ namespace PHPUnit\TextUI\Command; use const PHP_EOL; +use function assert; use function sprintf; use function version_compare; use PHPUnit\Util\Http\Downloader; @@ -34,9 +35,14 @@ public function __construct(Downloader $downloader, int $majorVersionNumber, str public function execute(): Result { - $latestVersion = $this->downloader->download('https://phar.phpunit.de/latest-version-of/phpunit'); + $latestVersion = $this->downloader->download('https://phar.phpunit.de/latest-version-of/phpunit'); + + assert($latestVersion !== false); + $latestCompatibleVersion = $this->downloader->download('https://phar.phpunit.de/latest-version-of/phpunit-' . $this->majorVersionNumber); + assert($latestCompatibleVersion !== false); + $notLatest = version_compare($latestVersion, $this->versionId, '>'); $notLatestCompatible = version_compare($latestCompatibleVersion, $this->versionId, '>');