File tree Expand file tree Collapse file tree 4 files changed +24
-10
lines changed Expand file tree Collapse file tree 4 files changed +24
-10
lines changed Original file line number Diff line number Diff line change @@ -598,17 +598,31 @@ protected function handleVersionCheck(): void
598
598
{
599
599
$ this ->printVersionString ();
600
600
601
- $ latestVersion = file_get_contents ('https://phar.phpunit.de/latest-version-of/phpunit ' );
602
- $ isOutdated = version_compare ( $ latestVersion , Version::id (), ' > ' );
601
+ $ latestVersion = file_get_contents ('https://phar.phpunit.de/latest-version-of/phpunit ' );
602
+ $ latestCompatibleVersion = file_get_contents ( ' https://phar.phpunit.de/latest-version-of/phpunit- ' . explode ( ' . ' , Version::series ())[ 0 ] );
603
603
604
- if ($ isOutdated ) {
604
+ $ notLatest = version_compare ($ latestVersion , Version::id (), '> ' );
605
+ $ notLatestCompatible = version_compare ($ latestCompatibleVersion , Version::id (), '> ' );
606
+
607
+ if ($ notLatest || $ notLatestCompatible ) {
608
+ print 'You are not using the latest version of PHPUnit. ' . PHP_EOL ;
609
+ } else {
610
+ print 'You are using the latest version of PHPUnit. ' . PHP_EOL ;
611
+ }
612
+
613
+ if ($ notLatestCompatible ) {
614
+ printf (
615
+ 'The latest version compatible with PHPUnit %s is PHPUnit %s. ' . PHP_EOL ,
616
+ Version::id (),
617
+ $ latestCompatibleVersion
618
+ );
619
+ }
620
+
621
+ if ($ notLatest ) {
605
622
printf (
606
- 'You are not using the latest version of PHPUnit. ' . PHP_EOL .
607
623
'The latest version is PHPUnit %s. ' . PHP_EOL ,
608
624
$ latestVersion ,
609
625
);
610
- } else {
611
- print 'You are using the latest version of PHPUnit. ' . PHP_EOL ;
612
626
}
613
627
614
628
exit (TestRunner::SUCCESS_EXIT );
Original file line number Diff line number Diff line change @@ -273,7 +273,7 @@ private function elements(): array
273
273
['arg ' => '-h|--help ' , 'desc ' => 'Prints this usage information ' ],
274
274
['arg ' => '--version ' , 'desc ' => 'Prints the version and exits ' ],
275
275
['arg ' => '--atleast-version <min> ' , 'desc ' => 'Checks that version is greater than min and exits ' ],
276
- ['arg ' => '--check-version ' , 'desc ' => 'Check whether PHPUnit is the latest version ' ],
276
+ ['arg ' => '--check-version ' , 'desc ' => 'Checks whether PHPUnit is the latest version and exits ' ],
277
277
];
278
278
279
279
return $ elements ;
Original file line number Diff line number Diff line change 139
139
[32m--version [0m Prints the version and exits
140
140
[32m--atleast-version [36m<min>[0m [0m Checks that version is greater than min
141
141
and exits
142
- [32m--check-version [0m Check whether PHPUnit is the latest
143
- version
142
+ [32m--check-version [0m Checks whether PHPUnit is the latest
143
+ version and exits
144
144
Original file line number Diff line number Diff line change @@ -109,4 +109,4 @@ Miscellaneous Options:
109
109
-h|--help Prints this usage information
110
110
--version Prints the version and exits
111
111
--atleast-version <min> Checks that version is greater than min and exits
112
- --check-version Check whether PHPUnit is the latest version
112
+ --check-version Checks whether PHPUnit is the latest version and exits
You can’t perform that action at this time.
0 commit comments