diff --git a/composer.json b/composer.json index 52ad9dc..f5c034d 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "description": "This package provides ArraySubset and related asserts once deprecated in PHPUnit 8", "type": "library", "require": { - "phpunit/phpunit": "^4.8.36 || ^5.7.21 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0", + "phpunit/phpunit": "^4.8.36 || ^5.7.21 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0", "php": "^5.4 || ^7.0 || ^8.0" }, "license": "MIT", diff --git a/src/Constraint/ArraySubset.php b/src/Constraint/ArraySubset.php index 4e04156..9515b26 100644 --- a/src/Constraint/ArraySubset.php +++ b/src/Constraint/ArraySubset.php @@ -10,6 +10,7 @@ use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\SebastianBergmann\Comparator\ComparisonFailure as Phar_ComparisonFailure; use SebastianBergmann\Comparator\ComparisonFailure; +use SebastianBergmann\Exporter\Exporter; use SebastianBergmann\RecursionContext\InvalidArgumentException; use Traversable; @@ -107,7 +108,9 @@ public function evaluate($other, string $description = '', bool $returnResult = */ public function toString(): string { - return 'has the subset ' . $this->exporter()->export($this->subset); + $exporter = method_exists($this, 'exporter') ? $this->exporter() : new Exporter(); + + return 'has the subset ' . $exporter->export($this->subset); } /**