Skip to content

Commit

Permalink
Assert assumptions
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Oct 21, 2024
1 parent b5228fe commit 9145fbc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/TextUI/Command/Commands/VersionCheckCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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, '>');

Expand Down

0 comments on commit 9145fbc

Please sign in to comment.