@@ -54,9 +54,9 @@ public static function register($mode = 0)
54
54
if (false === $ mode ) {
55
55
$ mode = getenv ('SYMFONY_DEPRECATIONS_HELPER ' );
56
56
}
57
- if (DeprecationErrorHandler ::MODE_DISABLED !== $ mode
58
- && DeprecationErrorHandler ::MODE_WEAK !== $ mode
59
- && DeprecationErrorHandler ::MODE_WEAK_VENDORS !== $ mode
57
+ if (self ::MODE_DISABLED !== $ mode
58
+ && self ::MODE_WEAK !== $ mode
59
+ && self ::MODE_WEAK_VENDORS !== $ mode
60
60
&& (!isset ($ mode [0 ]) || '/ ' !== $ mode [0 ])
61
61
) {
62
62
$ mode = preg_match ('/^[1-9][0-9]*$/ ' , $ mode ) ? (int ) $ mode : 0 ;
@@ -92,29 +92,29 @@ public static function register($mode = 0)
92
92
return false ;
93
93
};
94
94
95
- $ deprecations = array (
95
+ $ deprecations = [
96
96
'unsilencedCount ' => 0 ,
97
97
'remainingCount ' => 0 ,
98
98
'legacyCount ' => 0 ,
99
99
'otherCount ' => 0 ,
100
100
'remaining vendorCount ' => 0 ,
101
- 'unsilenced ' => array () ,
102
- 'remaining ' => array () ,
103
- 'legacy ' => array () ,
104
- 'other ' => array () ,
105
- 'remaining vendor ' => array () ,
106
- ) ;
107
- $ deprecationHandler = function ($ type , $ msg , $ file , $ line , $ context = array () ) use (&$ deprecations , $ getMode , $ UtilPrefix , $ inVendors ) {
101
+ 'unsilenced ' => [] ,
102
+ 'remaining ' => [] ,
103
+ 'legacy ' => [] ,
104
+ 'other ' => [] ,
105
+ 'remaining vendor ' => [] ,
106
+ ] ;
107
+ $ deprecationHandler = function ($ type , $ msg , $ file , $ line , $ context = [] ) use (&$ deprecations , $ getMode , $ UtilPrefix , $ inVendors ) {
108
108
$ mode = $ getMode ();
109
- if ((E_USER_DEPRECATED !== $ type && E_DEPRECATED !== $ type ) || DeprecationErrorHandler ::MODE_DISABLED === $ mode ) {
109
+ if ((E_USER_DEPRECATED !== $ type && E_DEPRECATED !== $ type ) || self ::MODE_DISABLED === $ mode ) {
110
110
$ ErrorHandler = $ UtilPrefix .'ErrorHandler ' ;
111
111
112
112
return $ ErrorHandler ::handleError ($ type , $ msg , $ file , $ line , $ context );
113
113
}
114
114
115
115
$ trace = debug_backtrace ();
116
116
$ group = 'other ' ;
117
- $ isVendor = DeprecationErrorHandler ::MODE_WEAK_VENDORS === $ mode && $ inVendors ($ file );
117
+ $ isVendor = self ::MODE_WEAK_VENDORS === $ mode && $ inVendors ($ file );
118
118
119
119
$ i = \count ($ trace );
120
120
while (1 < $ i && (!isset ($ trace [--$ i ]['class ' ]) || ('ReflectionMethod ' === $ trace [$ i ]['class ' ] || 0 === strpos ($ trace [$ i ]['class ' ], 'PHPUnit_ ' ) || 0 === strpos ($ trace [$ i ]['class ' ], 'PHPUnit \\' )))) {
@@ -131,7 +131,7 @@ public static function register($mode = 0)
131
131
// \Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerTrait::endTest()
132
132
// then we need to use the serialized information to determine
133
133
// if the error has been triggered from vendor code.
134
- $ isVendor = DeprecationErrorHandler ::MODE_WEAK_VENDORS === $ mode && isset ($ parsedMsg ['triggering_file ' ]) && $ inVendors ($ parsedMsg ['triggering_file ' ]);
134
+ $ isVendor = self ::MODE_WEAK_VENDORS === $ mode && isset ($ parsedMsg ['triggering_file ' ]) && $ inVendors ($ parsedMsg ['triggering_file ' ]);
135
135
} else {
136
136
$ class = isset ($ trace [$ i ]['object ' ]) ? \get_class ($ trace [$ i ]['object ' ]) : $ trace [$ i ]['class ' ];
137
137
$ method = $ trace [$ i ]['function ' ];
@@ -168,13 +168,13 @@ public static function register($mode = 0)
168
168
169
169
exit (1 );
170
170
}
171
- if ('legacy ' !== $ group && DeprecationErrorHandler ::MODE_WEAK !== $ mode ) {
171
+ if ('legacy ' !== $ group && self ::MODE_WEAK !== $ mode ) {
172
172
$ ref = &$ deprecations [$ group ][$ msg ]['count ' ];
173
173
++$ ref ;
174
174
$ ref = &$ deprecations [$ group ][$ msg ][$ class .':: ' .$ method ];
175
175
++$ ref ;
176
176
}
177
- } elseif (DeprecationErrorHandler ::MODE_WEAK !== $ mode ) {
177
+ } elseif (self ::MODE_WEAK !== $ mode ) {
178
178
$ ref = &$ deprecations [$ group ][$ msg ]['count ' ];
179
179
++$ ref ;
180
180
}
@@ -184,7 +184,7 @@ public static function register($mode = 0)
184
184
185
185
if (null !== $ oldErrorHandler ) {
186
186
restore_error_handler ();
187
- if (array ( $ UtilPrefix .'ErrorHandler ' , 'handleError ' ) === $ oldErrorHandler ) {
187
+ if ([ $ UtilPrefix .'ErrorHandler ' , 'handleError ' ] === $ oldErrorHandler ) {
188
188
restore_error_handler ();
189
189
self ::register ($ mode );
190
190
}
@@ -207,7 +207,7 @@ public static function register($mode = 0)
207
207
$ currErrorHandler = set_error_handler ('var_dump ' );
208
208
restore_error_handler ();
209
209
210
- if (DeprecationErrorHandler ::MODE_WEAK === $ mode ) {
210
+ if (self ::MODE_WEAK === $ mode ) {
211
211
$ colorize = function ($ str ) { return $ str ; };
212
212
}
213
213
if ($ currErrorHandler !== $ deprecationHandler ) {
@@ -218,8 +218,8 @@ public static function register($mode = 0)
218
218
return $ b ['count ' ] - $ a ['count ' ];
219
219
};
220
220
221
- $ groups = array ( 'unsilenced ' , 'remaining ' ) ;
222
- if (DeprecationErrorHandler ::MODE_WEAK_VENDORS === $ mode ) {
221
+ $ groups = [ 'unsilenced ' , 'remaining ' ] ;
222
+ if (self ::MODE_WEAK_VENDORS === $ mode ) {
223
223
$ groups [] = 'remaining vendor ' ;
224
224
}
225
225
array_push ($ groups , 'legacy ' , 'other ' );
@@ -255,11 +255,11 @@ public static function register($mode = 0)
255
255
$ displayDeprecations ($ deprecations );
256
256
257
257
// store failing status
258
- $ isFailing = DeprecationErrorHandler ::MODE_WEAK !== $ mode && $ mode < $ deprecations ['unsilencedCount ' ] + $ deprecations ['remainingCount ' ] + $ deprecations ['otherCount ' ];
258
+ $ isFailing = self ::MODE_WEAK !== $ mode && $ mode < $ deprecations ['unsilencedCount ' ] + $ deprecations ['remainingCount ' ] + $ deprecations ['otherCount ' ];
259
259
260
260
// reset deprecations array
261
261
foreach ($ deprecations as $ group => $ arrayOrInt ) {
262
- $ deprecations [$ group ] = \is_int ($ arrayOrInt ) ? 0 : array () ;
262
+ $ deprecations [$ group ] = \is_int ($ arrayOrInt ) ? 0 : [] ;
263
263
}
264
264
265
265
register_shutdown_function (function () use (&$ deprecations , $ isFailing , $ displayDeprecations , $ mode ) {
@@ -270,7 +270,7 @@ public static function register($mode = 0)
270
270
}
271
271
}
272
272
$ displayDeprecations ($ deprecations );
273
- if ($ isFailing || DeprecationErrorHandler ::MODE_WEAK !== $ mode && $ mode < $ deprecations ['unsilencedCount ' ] + $ deprecations ['remainingCount ' ] + $ deprecations ['otherCount ' ]) {
273
+ if ($ isFailing || self ::MODE_WEAK !== $ mode && $ mode < $ deprecations ['unsilencedCount ' ] + $ deprecations ['remainingCount ' ] + $ deprecations ['otherCount ' ]) {
274
274
exit (1 );
275
275
}
276
276
});
@@ -280,8 +280,8 @@ public static function register($mode = 0)
280
280
281
281
public static function collectDeprecations ($ outputFile )
282
282
{
283
- $ deprecations = array () ;
284
- $ previousErrorHandler = set_error_handler (function ($ type , $ msg , $ file , $ line , $ context = array () ) use (&$ deprecations , &$ previousErrorHandler ) {
283
+ $ deprecations = [] ;
284
+ $ previousErrorHandler = set_error_handler (function ($ type , $ msg , $ file , $ line , $ context = [] ) use (&$ deprecations , &$ previousErrorHandler ) {
285
285
if (E_USER_DEPRECATED !== $ type && E_DEPRECATED !== $ type ) {
286
286
if ($ previousErrorHandler ) {
287
287
return $ previousErrorHandler ($ type , $ msg , $ file , $ line , $ context );
@@ -293,7 +293,7 @@ public static function collectDeprecations($outputFile)
293
293
294
294
return $ ErrorHandler ::handleError ($ type , $ msg , $ file , $ line , $ context );
295
295
}
296
- $ deprecations [] = array ( error_reporting (), $ msg , $ file) ;
296
+ $ deprecations [] = [ error_reporting (), $ msg , $ file] ;
297
297
});
298
298
299
299
register_shutdown_function (function () use ($ outputFile , &$ deprecations ) {
0 commit comments