Skip to content

Commit 47f3667

Browse files
bug #60645 [PhpUnitBridge] Skip bootstrap for PHPUnit >=10 (HypeMC)
This PR was merged into the 7.2 branch. Discussion ---------- [PhpUnitBridge] Skip bootstrap for PHPUnit >=10 | Q | A | ------------- | --- | Branch? | 7.2 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix symfony/recipes#1425 (comment) | License | MIT As suggested by `@wouterj`, this will skip the bootstrap file that is automatically [required by the bridge's `composer.json`](https://github.com/symfony/symfony/blob/158dff8106151b943fad16f85bcf8b70b7bb1178/src/Symfony/Bridge/PhpUnit/composer.json#L32). I'm not sure whether to skip the entire file or only the part that registers the `DeprecationErrorHandler`. Commits ------- 36974c3 [PhpUnitBridge] Skip bootstrap for PHPUnit >=10
2 parents 39d4e97 + 36974c3 commit 47f3667

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/Symfony/Bridge/PhpUnit/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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy