Skip to content

Commit cd05f62

Browse files
committed
Fix compatibility of mock generation with PHPUnit 12
1 parent 2a4ea96 commit cd05f62

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Stub.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,11 @@ public static function constructEmptyExcept(
416416
private static function generateMock()
417417
{
418418
$args = func_get_args();
419-
if (version_compare(PHPUnitVersion::series(), '11', '>=')) {
419+
// PHPUnit 11 added the optional parameter $markAsMockObject:
420+
// https://github.com/sebastianbergmann/phpunit/commit/db9ae302fe1ad89451ecfacc850e88ab7c6df5a3
421+
// The parameter was removed in PHPUnit 12:
422+
// https://github.com/sebastianbergmann/phpunit/commit/a98e3939c74f6103cbeb7a785b73eb4a10784474
423+
if (version_compare(PHPUnitVersion::series(), '11', '>=') && version_compare(PHPUnitVersion::series(), '12', '<')) {
420424
if (!is_bool($args[1]) || !is_bool($args[2])) {
421425
$additionalParameters = [];
422426
if (!is_bool($args[1])) {

0 commit comments

Comments
 (0)