Skip to content

Commit

Permalink
add compatibility with PHPUnit 11
Browse files Browse the repository at this point in the history
  • Loading branch information
dmaicher committed Mar 11, 2024
1 parent 1aa0d83 commit a4c9fb8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 4 additions & 1 deletion src/Constraint/ArraySubset.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
}

/**
Expand Down

0 comments on commit a4c9fb8

Please sign in to comment.