@@ -110,7 +110,7 @@ public static function register($mode = 0)
110
110
111
111
$ trace = debug_backtrace (true );
112
112
$ group = 'other ' ;
113
- $ isVendor = DeprecationErrorHandler:: MODE_WEAK_VENDORS === $ mode && $ inVendors ($ file );
113
+ $ isVendor = $ inVendors ($ file );
114
114
115
115
$ i = count ($ trace );
116
116
while (1 < $ i && (!isset ($ trace [--$ i ]['class ' ]) || ('ReflectionMethod ' === $ trace [$ i ]['class ' ] || 0 === strpos ($ trace [$ i ]['class ' ], 'PHPUnit_ ' ) || 0 === strpos ($ trace [$ i ]['class ' ], 'PHPUnit \\' )))) {
@@ -127,7 +127,7 @@ public static function register($mode = 0)
127
127
// \Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerTrait::endTest()
128
128
// then we need to use the serialized information to determine
129
129
// if the error has been triggered from vendor code.
130
- $ isVendor = DeprecationErrorHandler:: MODE_WEAK_VENDORS === $ mode && isset ($ parsedMsg ['triggering_file ' ]) && $ inVendors ($ parsedMsg ['triggering_file ' ]);
130
+ $ isVendor = isset ($ parsedMsg ['triggering_file ' ]) && $ inVendors ($ parsedMsg ['triggering_file ' ]);
131
131
} else {
132
132
$ class = isset ($ trace [$ i ]['object ' ]) ? get_class ($ trace [$ i ]['object ' ]) : $ trace [$ i ]['class ' ];
133
133
$ method = $ trace [$ i ]['function ' ];
@@ -214,11 +214,7 @@ public static function register($mode = 0)
214
214
return $ b ['count ' ] - $ a ['count ' ];
215
215
};
216
216
217
- $ groups = array ('unsilenced ' , 'remaining ' );
218
- if (DeprecationErrorHandler::MODE_WEAK_VENDORS === $ mode ) {
219
- $ groups [] = 'remaining vendor ' ;
220
- }
221
- array_push ($ groups , 'legacy ' , 'other ' );
217
+ $ groups = array ('unsilenced ' , 'remaining ' , 'remaining vendor ' , 'legacy ' , 'other ' );
222
218
223
219
$ displayDeprecations = function ($ deprecations ) use ($ colorize , $ cmp , $ groups ) {
224
220
foreach ($ groups as $ group ) {
@@ -249,24 +245,34 @@ public static function register($mode = 0)
249
245
};
250
246
251
247
$ displayDeprecations ($ deprecations );
248
+ $ isPassing = function ($ mode , $ deprecations ) {
249
+ if (DeprecationErrorHandler::MODE_WEAK === $ mode ) {
250
+ return true ;
251
+ }
252
+ if (DeprecationErrorHandler::MODE_WEAK_VENDORS === $ mode ) {
253
+ return 0 === $ deprecations ['unsilencedCount ' ] + $ deprecations ['remainingCount ' ] + $ deprecations ['otherCount ' ];
254
+ }
255
+
256
+ return 0 === $ deprecations ['unsilencedCount ' ] + $ deprecations ['remainingCount ' ] + $ deprecations ['remaining vendorCount ' ] + $ deprecations ['otherCount ' ];
257
+ };
252
258
253
259
// store failing status
254
- $ isFailing = DeprecationErrorHandler:: MODE_WEAK !== $ mode && $ mode < $ deprecations[ ' unsilencedCount ' ] + $ deprecations [ ' remainingCount ' ] + $ deprecations [ ' otherCount ' ] ;
260
+ $ passesBeforeShutdown = ! $ isPassing ( $ mode, $ deprecations) ;
255
261
256
262
// reset deprecations array
257
263
foreach ($ deprecations as $ group => $ arrayOrInt ) {
258
264
$ deprecations [$ group ] = is_int ($ arrayOrInt ) ? 0 : array ();
259
265
}
260
266
261
- register_shutdown_function (function () use (&$ deprecations , $ isFailing , $ displayDeprecations , $ mode ) {
267
+ register_shutdown_function (function () use (&$ deprecations , $ passesBeforeShutdown , $ displayDeprecations, $ isPassing , $ mode ) {
262
268
foreach ($ deprecations as $ group => $ arrayOrInt ) {
263
269
if (0 < (is_int ($ arrayOrInt ) ? $ arrayOrInt : count ($ arrayOrInt ))) {
264
270
echo "Shutdown-time deprecations: \n" ;
265
271
break ;
266
272
}
267
273
}
268
274
$ displayDeprecations ($ deprecations );
269
- if ($ isFailing || DeprecationErrorHandler:: MODE_WEAK !== $ mode && $ mode < $ deprecations[ ' unsilencedCount ' ] + $ deprecations [ ' remainingCount ' ] + $ deprecations [ ' otherCount ' ] ) {
275
+ if (! $ passesBeforeShutdown || ! $ isPassing ( $ mode, $ deprecations) ) {
270
276
exit (1 );
271
277
}
272
278
});
0 commit comments