Skip to content

Commit

Permalink
Adjust PHPUnit 5 check to be consistent with others
Browse files Browse the repository at this point in the history
This is consistent with how other versions are checked, and also reduces
esoteric bugs when PHPUnit_TextUI_ResultPrinter exists, even though the
PHPUnit version is newer.
  • Loading branch information
kostajh committed Dec 1, 2021
1 parent b04ebbc commit a7d8930
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/Printer.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,20 @@
use PHPUnit\Runner\Version;
use PHPUnit_TextUI_ResultPrinter;

if (class_exists(PHPUnit_TextUI_ResultPrinter::class)) {
$low = version_compare(Version::series(), '5.0', '>=');
$high = version_compare(Version::series(), '5.99.99', '<=');

if ($low && $high) {
class Printer extends ResultPrinter5
{
use PrinterTrait;
}
}

if (version_compare(Version::series(), '6.99.99', '<=')) {
$low = version_compare(Version::series(), '6.0', '>=');
$high = version_compare(Version::series(), '6.99.99', '<=');

if ($low && $high) {
class Printer extends ResultPrinter6
{
use PrinterTrait;
Expand Down

0 comments on commit a7d8930

Please sign in to comment.