Skip to content

Commit 0b386a5

Browse files
[PhpUnitBridge] Fix classifying doctrine/deprecations as direct/indirect
1 parent b99bcd7 commit 0b386a5

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

DeprecationErrorHandler/Deprecation.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bridge\PhpUnit\DeprecationErrorHandler;
1313

14+
use Doctrine\Deprecations\Deprecation as DoctrineDeprecation;
1415
use PHPUnit\Framework\TestCase;
1516
use PHPUnit\Framework\TestSuite;
1617
use PHPUnit\Metadata\Api\Groups;
@@ -60,9 +61,18 @@ class Deprecation
6061
*/
6162
public function __construct($message, array $trace, $file, $languageDeprecation = false)
6263
{
63-
if (isset($trace[2]['function']) && 'trigger_deprecation' === $trace[2]['function']) {
64-
$file = $trace[2]['file'];
65-
array_splice($trace, 1, 1);
64+
switch ($trace[2]['function'] ?? '') {
65+
case 'trigger_deprecation':
66+
$file = $trace[2]['file'];
67+
array_splice($trace, 1, 1);
68+
break;
69+
70+
case 'delegateTriggerToBackend':
71+
if (DoctrineDeprecation::class === ($trace[2]['class'] ?? '')) {
72+
$file = $trace[3]['file'];
73+
array_splice($trace, 1, 2);
74+
}
75+
break;
6676
}
6777

6878
$this->trace = $trace;

0 commit comments

Comments
 (0)