Skip to content

Commit a8186c5

Browse files
committed
[PhpUnitBridge] Skip bootstrap for PHPUnit >=10
1 parent e505247 commit a8186c5

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

bootstrap.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@
1414
use Symfony\Bridge\PhpUnit\DeprecationErrorHandler;
1515

1616
// Detect if we need to serialize deprecations to a file.
17-
if (in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) && $file = getenv('SYMFONY_DEPRECATIONS_SERIALIZE')) {
17+
if (
18+
// Skip if we're using PHPUnit >=10
19+
!class_exists(PHPUnit\Metadata\Metadata::class)
20+
&& in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) && $file = getenv('SYMFONY_DEPRECATIONS_SERIALIZE')
21+
) {
1822
DeprecationErrorHandler::collectDeprecations($file);
1923

2024
return;
@@ -46,6 +50,10 @@
4650
}
4751
}
4852

49-
if ('disabled' !== getenv('SYMFONY_DEPRECATIONS_HELPER')) {
53+
if (
54+
// Skip if we're using PHPUnit >=10
55+
!class_exists(PHPUnit\Metadata\Metadata::class, false)
56+
&& 'disabled' !== getenv('SYMFONY_DEPRECATIONS_HELPER')
57+
) {
5058
DeprecationErrorHandler::register(getenv('SYMFONY_DEPRECATIONS_HELPER'));
5159
}

0 commit comments

Comments
 (0)