Skip to content

Commit

Permalink
Merge pull request #48 from W0rma/phpunit11
Browse files Browse the repository at this point in the history
Support PHPUnit 11
  • Loading branch information
Naktibalda committed Feb 2, 2024
2 parents f6bc56e + d3a073b commit 4fcad2c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"require": {
"php": "^7.4 | ^8.0",
"phpunit/phpunit": "^8.4 | ^9.0 | ^10.0 | 10.0.x-dev"
"phpunit/phpunit": "^8.4 | ^9.0 | ^10.0 | ^11"
},
"require-dev": {
"consolidation/robo": "^3.0"
Expand Down
14 changes: 13 additions & 1 deletion src/Stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,19 @@ public static function constructEmptyExcept(
private static function generateMock()
{
$args = func_get_args();
if (version_compare(PHPUnitVersion::series(), '10.4', '>=') && !is_bool($args[1])) {
if (version_compare(PHPUnitVersion::series(), '11', '>=')) {
if (!is_bool($args[1]) || !is_bool($args[2])) {
$additionalParameters = [];
if (!is_bool($args[1])) {
$additionalParameters[] = true;
}
if (!is_bool($args[2])) {
$additionalParameters[] = true;
}

array_splice($args, 1, 0, $additionalParameters);
}
} elseif (version_compare(PHPUnitVersion::series(), '10.4', '>=') && !is_bool($args[1])) {
array_splice($args, 1, 0, [true]);
}

Expand Down

0 comments on commit 4fcad2c

Please sign in to comment.