@@ -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 (self ::MODE_DISABLED !== $ mode
58
- && self ::MODE_WEAK !== $ mode
59
- && self ::MODE_WEAK_VENDORS !== $ mode
57
+ if (DeprecationErrorHandler ::MODE_DISABLED !== $ mode
58
+ && DeprecationErrorHandler ::MODE_WEAK !== $ mode
59
+ && DeprecationErrorHandler ::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 ;
@@ -106,15 +106,15 @@ public static function register($mode = 0)
106
106
);
107
107
$ deprecationHandler = function ($ type , $ msg , $ file , $ line , $ context = array ()) use (&$ deprecations , $ getMode , $ UtilPrefix , $ inVendors ) {
108
108
$ mode = $ getMode ();
109
- if ((E_USER_DEPRECATED !== $ type && E_DEPRECATED !== $ type ) || self ::MODE_DISABLED === $ mode ) {
109
+ if ((E_USER_DEPRECATED !== $ type && E_DEPRECATED !== $ type ) || DeprecationErrorHandler ::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 = self ::MODE_WEAK_VENDORS === $ mode && $ inVendors ($ file );
117
+ $ isVendor = DeprecationErrorHandler ::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 = self ::MODE_WEAK_VENDORS === $ mode && isset ($ parsedMsg ['triggering_file ' ]) && $ inVendors ($ parsedMsg ['triggering_file ' ]);
134
+ $ isVendor = DeprecationErrorHandler ::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 && self ::MODE_WEAK !== $ mode ) {
171
+ if ('legacy ' !== $ group && DeprecationErrorHandler ::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 (self ::MODE_WEAK !== $ mode ) {
177
+ } elseif (DeprecationErrorHandler ::MODE_WEAK !== $ mode ) {
178
178
$ ref = &$ deprecations [$ group ][$ msg ]['count ' ];
179
179
++$ ref ;
180
180
}
@@ -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 (self ::MODE_WEAK === $ mode ) {
210
+ if (DeprecationErrorHandler ::MODE_WEAK === $ mode ) {
211
211
$ colorize = function ($ str ) { return $ str ; };
212
212
}
213
213
if ($ currErrorHandler !== $ deprecationHandler ) {
@@ -219,7 +219,7 @@ public static function register($mode = 0)
219
219
};
220
220
221
221
$ groups = array ('unsilenced ' , 'remaining ' );
222
- if (self ::MODE_WEAK_VENDORS === $ mode ) {
222
+ if (DeprecationErrorHandler ::MODE_WEAK_VENDORS === $ mode ) {
223
223
$ groups [] = 'remaining vendor ' ;
224
224
}
225
225
array_push ($ groups , 'legacy ' , 'other ' );
@@ -255,7 +255,7 @@ public static function register($mode = 0)
255
255
$ displayDeprecations ($ deprecations );
256
256
257
257
// store failing status
258
- $ isFailing = self ::MODE_WEAK !== $ mode && $ mode < $ deprecations ['unsilencedCount ' ] + $ deprecations ['remainingCount ' ] + $ deprecations ['otherCount ' ];
258
+ $ isFailing = DeprecationErrorHandler ::MODE_WEAK !== $ mode && $ mode < $ deprecations ['unsilencedCount ' ] + $ deprecations ['remainingCount ' ] + $ deprecations ['otherCount ' ];
259
259
260
260
// reset deprecations array
261
261
foreach ($ deprecations as $ group => $ arrayOrInt ) {
@@ -270,7 +270,7 @@ public static function register($mode = 0)
270
270
}
271
271
}
272
272
$ displayDeprecations ($ deprecations );
273
- if ($ isFailing || self ::MODE_WEAK !== $ mode && $ mode < $ deprecations ['unsilencedCount ' ] + $ deprecations ['remainingCount ' ] + $ deprecations ['otherCount ' ]) {
273
+ if ($ isFailing || DeprecationErrorHandler ::MODE_WEAK !== $ mode && $ mode < $ deprecations ['unsilencedCount ' ] + $ deprecations ['remainingCount ' ] + $ deprecations ['otherCount ' ]) {
274
274
exit (1 );
275
275
}
276
276
});
0 commit comments