@@ -116,8 +116,16 @@ public static function register($mode = 0)
116
116
}
117
117
118
118
if (isset ($ trace [$ i ]['object ' ]) || isset ($ trace [$ i ]['class ' ])) {
119
- $ class = isset ($ trace [$ i ]['object ' ]) ? get_class ($ trace [$ i ]['object ' ]) : $ trace [$ i ]['class ' ];
120
- $ method = $ trace [$ i ]['function ' ];
119
+ if (isset ($ trace [$ i ]['class ' ]) && in_array ($ trace [$ i ]['class ' ], array ('Symfony\Bridge\PhpUnit\SymfonyTestsListener ' , 'Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListener ' ), true )) {
120
+ $ parsedMsg = unserialize ($ msg );
121
+ $ msg = $ parsedMsg ['deprecation ' ];
122
+ $ class = $ parsedMsg ['class ' ];
123
+ $ method = $ parsedMsg ['method ' ];
124
+ } else {
125
+ $ class = isset ($ trace [$ i ]['object ' ]) ? get_class ($ trace [$ i ]['object ' ]) : $ trace [$ i ]['class ' ];
126
+ $ method = $ trace [$ i ]['function ' ];
127
+ }
128
+
121
129
$ Test = $ UtilPrefix .'Test ' ;
122
130
123
131
if (0 !== error_reporting ()) {
@@ -245,7 +253,14 @@ public static function collectDeprecations($outputFile)
245
253
if (E_USER_DEPRECATED !== $ type && E_DEPRECATED !== $ type ) {
246
254
return $ previousErrorHandler ? $ previousErrorHandler ($ type , $ msg , $ file , $ line , $ context ) : false ;
247
255
}
248
- $ deprecations [] = array (error_reporting (), $ msg );
256
+ $ trace = debug_backtrace (true );
257
+ $ i = count ($ trace );
258
+ while (1 < $ i && (!isset ($ trace [--$ i ]['class ' ]) || ('ReflectionMethod ' === $ trace [$ i ]['class ' ] || 0 === strpos ($ trace [$ i ]['class ' ], 'PHPUnit_ ' ) || 0 === strpos ($ trace [$ i ]['class ' ], 'PHPUnit \\' )))) {
259
+ // No-op
260
+ }
261
+ $ class = isset ($ trace [$ i ]['object ' ]) ? get_class ($ trace [$ i ]['object ' ]) : $ trace [$ i ]['class ' ];
262
+ $ method = $ trace [$ i ]['function ' ];
263
+ $ deprecations [] = array (error_reporting (), $ msg , $ class , $ method );
249
264
});
250
265
register_shutdown_function (function () use ($ outputFile , &$ deprecations ) {
251
266
file_put_contents ($ outputFile , serialize ($ deprecations ));
0 commit comments