diff --git a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php index daab2d2ad57a1..59bcdbcbc6670 100644 --- a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php +++ b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php @@ -12,7 +12,6 @@ namespace Symfony\Bridge\PhpUnit\DeprecationErrorHandler; use PHPUnit\Util\Test; -use Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerFor; /** * @internal @@ -61,10 +60,10 @@ public function __construct($message, array $trace, $file) $line = $trace[$i]; $this->triggeringFile = $file; if (isset($line['object']) || isset($line['class'])) { - if (isset($line['class']) && 0 === strpos($line['class'], SymfonyTestsListenerFor::class)) { - set_error_handler(function () {}); - $parsedMsg = unserialize($this->message); - restore_error_handler(); + set_error_handler(function () {}); + $parsedMsg = unserialize($this->message); + restore_error_handler(); + if ($parsedMsg && isset($parsedMsg['deprecation'])) { $this->message = $parsedMsg['deprecation']; $this->originClass = $parsedMsg['class']; $this->originMethod = $parsedMsg['method'];