Skip to content

Commit 40422d2

Browse files
committed
Adjust PHPUnit 5 check to be consistent with others
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.
1 parent b04ebbc commit 40422d2

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/Printer.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,21 @@
33
namespace Codedungeon\PHPUnitPrettyResultPrinter;
44

55
use PHPUnit\Runner\Version;
6-
use PHPUnit_TextUI_ResultPrinter;
76

8-
if (class_exists(PHPUnit_TextUI_ResultPrinter::class)) {
7+
$low = version_compare(Version::series(), '5.0', '>=');
8+
$high = version_compare(Version::series(), '5.99.99', '<=');
9+
10+
if ($low && $high) {
911
class Printer extends ResultPrinter5
1012
{
1113
use PrinterTrait;
1214
}
1315
}
1416

15-
if (version_compare(Version::series(), '6.99.99', '<=')) {
17+
$low = version_compare(Version::series(), '6.0', '>=');
18+
$high = version_compare(Version::series(), '6.99.99', '<=');
19+
20+
if ($low && $high) {
1621
class Printer extends ResultPrinter6
1722
{
1823
use PrinterTrait;

0 commit comments

Comments
 (0)