Skip to content

Commit

Permalink
bug #50525 [PhpUnitBridge] Fix classifying doctrine/deprecations as d…
Browse files Browse the repository at this point in the history
…irect/indirect (nicolas-grekas)

This PR was merged into the 6.3 branch.

Discussion
----------

[PhpUnitBridge] Fix classifying doctrine/deprecations as direct/indirect

| Q             | A
| ------------- | ---
| Branch?       | 6.3
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

Commits
-------

d2b5209 [PhpUnitBridge] Fix classifying doctrine/deprecations as direct/indirect
  • Loading branch information
nicolas-grekas committed Jun 1, 2023
2 parents c7fb0fd + d2b5209 commit 9217c57
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php
Expand Up @@ -11,6 +11,7 @@

namespace Symfony\Bridge\PhpUnit\DeprecationErrorHandler;

use Doctrine\Deprecations\Deprecation as DoctrineDeprecation;
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\TestSuite;
use PHPUnit\Metadata\Api\Groups;
Expand Down Expand Up @@ -60,9 +61,18 @@ class Deprecation
*/
public function __construct($message, array $trace, $file, $languageDeprecation = false)
{
if (isset($trace[2]['function']) && 'trigger_deprecation' === $trace[2]['function']) {
$file = $trace[2]['file'];
array_splice($trace, 1, 1);
switch ($trace[2]['function'] ?? '') {
case 'trigger_deprecation':
$file = $trace[2]['file'];
array_splice($trace, 1, 1);
break;

case 'delegateTriggerToBackend':
if (DoctrineDeprecation::class === ($trace[2]['class'] ?? '')) {
$file = $trace[3]['file'];
array_splice($trace, 1, 2);
}
break;
}

$this->trace = $trace;
Expand Down

0 comments on commit 9217c57

Please sign in to comment.