File tree Expand file tree Collapse file tree 1 file changed +20
-6
lines changed Expand file tree Collapse file tree 1 file changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -1142,17 +1142,31 @@ protected function handleVersionCheck(): void
1142
1142
{
1143
1143
$ this ->printVersionString ();
1144
1144
1145
- $ latestVersion = file_get_contents ('https://phar.phpunit.de/latest-version-of/phpunit ' );
1146
- $ isOutdated = version_compare ( $ latestVersion , Version::id (), ' > ' );
1145
+ $ latestVersion = file_get_contents ('https://phar.phpunit.de/latest-version-of/phpunit ' );
1146
+ $ latestCompatibleVersion = file_get_contents ( ' https://phar.phpunit.de/latest-version-of/phpunit- ' . explode ( ' . ' , Version::series ())[ 0 ] );
1147
1147
1148
- if ($ isOutdated ) {
1148
+ $ notLatest = version_compare ($ latestVersion , Version::id (), '> ' );
1149
+ $ notLatestCompatible = version_compare ($ latestCompatibleVersion , Version::id (), '> ' );
1150
+
1151
+ if ($ notLatest || $ notLatestCompatible ) {
1152
+ print 'You are not using the latest version of PHPUnit. ' . PHP_EOL ;
1153
+ } else {
1154
+ print 'You are using the latest version of PHPUnit. ' . PHP_EOL ;
1155
+ }
1156
+
1157
+ if ($ notLatestCompatible ) {
1158
+ printf (
1159
+ 'The latest version compatible with PHPUnit %s is PHPUnit %s. ' . PHP_EOL ,
1160
+ Version::id (),
1161
+ $ latestCompatibleVersion
1162
+ );
1163
+ }
1164
+
1165
+ if ($ notLatest ) {
1149
1166
printf (
1150
- 'You are not using the latest version of PHPUnit. ' . PHP_EOL .
1151
1167
'The latest version is PHPUnit %s. ' . PHP_EOL ,
1152
1168
$ latestVersion
1153
1169
);
1154
- } else {
1155
- print 'You are using the latest version of PHPUnit. ' . PHP_EOL ;
1156
1170
}
1157
1171
1158
1172
exit (TestRunner::SUCCESS_EXIT );
You can’t perform that action at this time.
0 commit comments