File tree Expand file tree Collapse file tree 2 files changed +32
-3
lines changed
src/Symfony/Bridge/PhpUnit Expand file tree Collapse file tree 2 files changed +32
-3
lines changed Original file line number Diff line number Diff line change @@ -90,6 +90,19 @@ public static function register($mode = 0)
90
90
}
91
91
}
92
92
93
+ /**
94
+ * @return bool
95
+ */
96
+ public static function isEnabled ()
97
+ {
98
+ return self ::getModeFromEnvironment () !== 'disabled ' ;
99
+ }
100
+
101
+ public static function registerAndConfigureFromEnvironment ()
102
+ {
103
+ self ::register (self ::getModeFromEnvironment ());
104
+ }
105
+
93
106
public static function collectDeprecations ($ outputFile )
94
107
{
95
108
$ deprecations = [];
@@ -209,12 +222,28 @@ public function shutdown()
209
222
});
210
223
}
211
224
225
+ /**
226
+ * @return mixed string|false
227
+ */
228
+ private static function getModeFromEnvironment ()
229
+ {
230
+ if (isset ($ _SERVER ['SYMFONY_DEPRECATIONS_HELPER ' ])) {
231
+ return $ _SERVER ['SYMFONY_DEPRECATIONS_HELPER ' ];
232
+ }
233
+
234
+ if (isset ($ _ENV ['SYMFONY_DEPRECATIONS_HELPER ' ])) {
235
+ return $ _ENV ['SYMFONY_DEPRECATIONS_HELPER ' ];
236
+ }
237
+
238
+ return getenv ('SYMFONY_DEPRECATIONS_HELPER ' );
239
+ }
240
+
212
241
private function getConfiguration ()
213
242
{
214
243
if (null !== $ this ->configuration ) {
215
244
return $ this ->configuration ;
216
245
}
217
- $ mode = getenv ( ' SYMFONY_DEPRECATIONS_HELPER ' );
246
+ $ mode = self :: getModeFromEnvironment ( );
218
247
if ('strict ' === $ mode ) {
219
248
return $ this ->configuration = Configuration::inStrictMode ();
220
249
}
Original file line number Diff line number Diff line change 35
35
}
36
36
}
37
37
38
- if (' disabled ' !== getenv ( ' SYMFONY_DEPRECATIONS_HELPER ' )) {
39
- DeprecationErrorHandler::register ( getenv ( ' SYMFONY_DEPRECATIONS_HELPER ' ) );
38
+ if (DeprecationErrorHandler:: isEnabled ( )) {
39
+ DeprecationErrorHandler::registerAndConfigureFromEnvironment ( );
40
40
}
You can’t perform that action at this time.
0 commit comments