Skip to content

Commit

Permalink
bug #26794 [PhpUnitBridge] Catch deprecation error handler (cvilleger)
Browse files Browse the repository at this point in the history
This PR was squashed before being merged into the 3.4 branch (closes #26794).

Discussion
----------

[PhpUnitBridge] Catch deprecation error handler

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #26476
| License       | MIT

This fix `DeprecationErrorHandler` to catch deprecation triggered by `SymfonyTestListenerTrait`. `$trace[$i]['class']` points to `Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerForV6`, not the aliased version. The condition has been refactored to handle future version `SymfonyTestsListenerForV{x}`

Commits
-------

f40f181 [PhpUnitBridge] Catch deprecation error handler
  • Loading branch information
nicolas-grekas committed Apr 4, 2018
2 parents 5d189e1 + f40f181 commit 603f3ab
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public static function register($mode = 0)
}

if (isset($trace[$i]['object']) || isset($trace[$i]['class'])) {
if (isset($trace[$i]['class']) && in_array($trace[$i]['class'], array('Symfony\Bridge\PhpUnit\SymfonyTestsListener', 'Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListener'), true)) {
if (isset($trace[$i]['class']) && 0 === strpos($trace[$i]['class'], 'Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerFor')) {
$parsedMsg = unserialize($msg);
$msg = $parsedMsg['deprecation'];
$class = $parsedMsg['class'];
Expand Down Expand Up @@ -216,7 +216,7 @@ public static function register($mode = 0)

$groups = array('unsilenced', 'remaining');
if (DeprecationErrorHandler::MODE_WEAK_VENDORS === $mode) {
$groups[] = 'remaining vendor';
$groups[] = 'remaining vendor';
}
array_push($groups, 'legacy', 'other');

Expand Down

0 comments on commit 603f3ab

Please sign in to comment.