Skip to content

Commit 4fcad2c

Browse files
authored
Merge pull request #48 from W0rma/phpunit11
Support PHPUnit 11
2 parents f6bc56e + d3a073b commit 4fcad2c

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
},
1212
"require": {
1313
"php": "^7.4 | ^8.0",
14-
"phpunit/phpunit": "^8.4 | ^9.0 | ^10.0 | 10.0.x-dev"
14+
"phpunit/phpunit": "^8.4 | ^9.0 | ^10.0 | ^11"
1515
},
1616
"require-dev": {
1717
"consolidation/robo": "^3.0"

src/Stub.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,19 @@ public static function constructEmptyExcept(
416416
private static function generateMock()
417417
{
418418
$args = func_get_args();
419-
if (version_compare(PHPUnitVersion::series(), '10.4', '>=') && !is_bool($args[1])) {
419+
if (version_compare(PHPUnitVersion::series(), '11', '>=')) {
420+
if (!is_bool($args[1]) || !is_bool($args[2])) {
421+
$additionalParameters = [];
422+
if (!is_bool($args[1])) {
423+
$additionalParameters[] = true;
424+
}
425+
if (!is_bool($args[2])) {
426+
$additionalParameters[] = true;
427+
}
428+
429+
array_splice($args, 1, 0, $additionalParameters);
430+
}
431+
} elseif (version_compare(PHPUnitVersion::series(), '10.4', '>=') && !is_bool($args[1])) {
420432
array_splice($args, 1, 0, [true]);
421433
}
422434

0 commit comments

Comments
 (0)