mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-06 00:05:42 +08:00
Refactor CheckUpdateResult logic to simplify version comparison
This commit is contained in:
@@ -32,7 +32,7 @@ class FileList implements DownloadTypeInterface, CheckUpdateInterface
|
||||
return new CheckUpdateResult(
|
||||
old: $old_version,
|
||||
new: $version,
|
||||
needUpdate: $old_version === null || version_compare($version, $old_version, '>'),
|
||||
needUpdate: $old_version === null || $version !== $old_version,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ class Git implements DownloadTypeInterface, CheckUpdateInterface
|
||||
return new CheckUpdateResult(
|
||||
old: $old_version,
|
||||
new: $version,
|
||||
needUpdate: $old_version === null || version_compare($version, $old_version, '>'),
|
||||
needUpdate: $old_version === null || $version !== $old_version,
|
||||
);
|
||||
}
|
||||
throw new DownloaderException("No matching branch found for regex {$config['regex']}.");
|
||||
|
||||
@@ -22,7 +22,7 @@ class PECL implements DownloadTypeInterface, CheckUpdateInterface
|
||||
return new CheckUpdateResult(
|
||||
old: $old_version,
|
||||
new: $version,
|
||||
needUpdate: $old_version === null || version_compare($version, $old_version, '>'),
|
||||
needUpdate: $old_version === null || $version !== $old_version,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ class PIE implements DownloadTypeInterface, CheckUpdateInterface
|
||||
return new CheckUpdateResult(
|
||||
old: $old_version,
|
||||
new: $new_version,
|
||||
needUpdate: $old_version === null || version_compare($new_version, $old_version, '>'),
|
||||
needUpdate: $old_version === null || $new_version !== $old_version,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user