File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed
src/Symfony/Bridge/PhpUnit Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change 1919class DeprecationErrorHandler
2020{
2121 const MODE_WEAK = 'weak ' ;
22- const MODE_WEAK_VERBOSE = 'weak-verbose ' ;
2322
2423 private static $ isRegistered = false ;
2524
@@ -28,6 +27,9 @@ public static function register($mode = false)
2827 if (self ::$ isRegistered ) {
2928 return ;
3029 }
30+ if (self ::MODE_WEAK !== $ mode && (!isset ($ mode [0 ]) || '/ ' !== $ mode [0 ])) {
31+ $ mode = preg_match ('/^[1-9][0-9]*$/ ' , $ mode ) ? (int ) $ mode : 0 ;
32+ }
3133 $ deprecations = array (
3234 'unsilencedCount ' => 0 ,
3335 'remainingCount ' => 0 ,
@@ -147,7 +149,7 @@ public static function register($mode = false)
147149 if (!empty ($ notices )) {
148150 echo "\n" ;
149151 }
150- if (DeprecationErrorHandler::MODE_WEAK !== $ mode && DeprecationErrorHandler:: MODE_WEAK_VERBOSE !== $ mode && ( $ deprecations ['unsilenced ' ] || $ deprecations ['remaining ' ] || $ deprecations ['other ' ]) ) {
152+ if (DeprecationErrorHandler::MODE_WEAK !== $ mode && $ mode < $ deprecations ['unsilencedCount ' ] + $ deprecations ['remainingCount ' ] + $ deprecations ['otherCount ' ] ) {
151153 exit (1 );
152154 }
153155 });
Original file line number Diff line number Diff line change @@ -12,11 +12,11 @@ It comes with the following features:
1212 * display the stack trace of a deprecation on-demand.
1313
1414By default any non-legacy-tagged or any non-@-silenced deprecation notices will
15- make tests fail.
16- This can be changed by setting the ` SYMFONY_DEPRECATIONS_HELPER ` environment
17- variable to ` weak ` or ` weak-verbose ` . This will make the bridge ignore
18- deprecation notices and is useful to projects that must use deprecated interfaces
19- for backward compatibility reasons.
15+ make tests fail. This can be changed by setting the ` SYMFONY_DEPRECATIONS_HELPER `
16+ environment variable to the maximum number of deprecations that are allowed to be
17+ triggered before making the test suite fail. Alternatively, setting it to ` weak `
18+ will make the bridge ignore any deprecation notices and is useful to projects
19+ that must use deprecated interfaces for backward compatibility reasons.
2020
2121A summary of deprecation notices is displayed at the end of the test suite:
2222
You can’t perform that action at this time.
0 commit comments