Skip to content

Commit a4c9fb8

Browse files
committed
add compatibility with PHPUnit 11
1 parent 1aa0d83 commit a4c9fb8

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "This package provides ArraySubset and related asserts once deprecated in PHPUnit 8",
44
"type": "library",
55
"require": {
6-
"phpunit/phpunit": "^4.8.36 || ^5.7.21 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0",
6+
"phpunit/phpunit": "^4.8.36 || ^5.7.21 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0",
77
"php": "^5.4 || ^7.0 || ^8.0"
88
},
99
"license": "MIT",

src/Constraint/ArraySubset.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use PHPUnit\Framework\ExpectationFailedException;
1111
use PHPUnit\SebastianBergmann\Comparator\ComparisonFailure as Phar_ComparisonFailure;
1212
use SebastianBergmann\Comparator\ComparisonFailure;
13+
use SebastianBergmann\Exporter\Exporter;
1314
use SebastianBergmann\RecursionContext\InvalidArgumentException;
1415
use Traversable;
1516

@@ -107,7 +108,9 @@ public function evaluate($other, string $description = '', bool $returnResult =
107108
*/
108109
public function toString(): string
109110
{
110-
return 'has the subset ' . $this->exporter()->export($this->subset);
111+
$exporter = method_exists($this, 'exporter') ? $this->exporter() : new Exporter();
112+
113+
return 'has the subset ' . $exporter->export($this->subset);
111114
}
112115

113116
/**

0 commit comments

Comments
 (0)