8000 bug #50514 [PhpUnitBridge] Disable deduplication of Doctrine deprecat… · symfony/symfony@29fe9ff · GitHub
[go: up one dir, main page]

Skip to content

Commit 29fe9ff

Browse files
bug #50514 [PhpUnitBridge] Disable deduplication of Doctrine deprecations (nicolas-grekas)
This PR was merged into the 6.3 branch. Discussion ---------- [PhpUnitBridge] Disable deduplication of Doctrine deprecations | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Deprecation reports are not accurate with deduplication enabled. Commits ------- 03392b6 [PhpUnitBridge] Disable deduplication of Doctrine deprecations
2 parents 96c2dd7 + 03392b6 commit 29fe9ff

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/Symfony/Bridge/PhpUnit/bin/simple-phpunit.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,8 @@
260260
if ('\\' === \DIRECTORY_SEPARATOR) {
261261
file_put_contents('composer.json', preg_replace('/^( {8})"phpunit-bridge": \{$/m', "$0\n$1 ".'"options": {"symlink": false},', file_get_contents('composer.json')));
262262
}
263+
$phpunitBridgeComposerJson = file_get_contents($path.'/composer.json');
264+
file_put_contents($path.'/composer.json', preg_replace('/^( {8})"files": .*/m', '', $phpunitBridgeComposerJson));
263265
} else {
264266
$passthruOrFail("$COMPOSER require --no-update symfony/phpunit-bridge \"*\"");
265267
}
@@ -269,6 +271,9 @@
269271
// --no-suggest is not in the list to keep compat with composer 1.0, which is shipped with Ubuntu 16.04LTS
270272
$exit = proc_close(proc_open("$q$COMPOSER install --no-dev --prefer-dist --no-progress $q", [], $p, getcwd()));
271273
putenv('COMPOSER_ROOT_VERSION'.(false !== $prevRoot ? '='.$prevRoot : ''));
274+
if (file_exists($path)) {
275+
file_put_contents($path.'/composer.json', $phpunitBridgeComposerJson);
276+
}
272277
if ($prevCacheDir) {
273278
putenv("COMPOSER_CACHE_DIR=$prevCacheDir");
274279
}

src/Symfony/Bridge/PhpUnit/bootstrap.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010
*/
1111

1212
use Doctrine\Common\Annotations\AnnotationRegistry;
13+
use Doctrine\Deprecations\Deprecation;
1314
use Symfony\Bridge\PhpUnit\DeprecationErrorHandler;
1415

1516
// Detect if we need to serialize deprecations to a file.
16-
if ($file = getenv('SYMFONY_DEPRECATIONS_SERIALIZE')) {
17+
if (in_array(PHP_SAPI, ['cli', 'phpdbg'], true) && $file = getenv('SYMFONY_DEPRECATIONS_SERIALIZE')) {
1718
DeprecationErrorHandler::collectDeprecations($file);
1819

1920
return;
@@ -27,6 +28,10 @@
2728
// Enforce a consistent locale
2829
setlocale(\LC_ALL, 'C');
2930

31+
if (class_exists(Deprecation::class)) {
32+
Deprecation::withoutDeduplication();
33+
}
34+
3035
if (!class_exists(AnnotationRegistry::class, false) && class_exists(AnnotationRegistry::class)) {
3136
if (method_exists(AnnotationRegistry::class, 'registerUniqueLoader')) {
3237
AnnotationRegistry::registerUniqueLoader('class_exists');

0 commit comments

Comments
 (0)
0