@@ -47,16 +47,37 @@ public static function register($mode = false)
4747 // No-op
4848 }
4949
50- if (0 !== error_reporting ()) {
51- $ group = 'unsilenced ' ;
52- $ ref = &$ deprecations [$ group ][$ msg ]['count ' ];
53- ++$ ref ;
54- } elseif (isset ($ trace [$ i ]['object ' ]) || isset ($ trace [$ i ]['class ' ])) {
50+ if (isset ($ trace [$ i ]['object ' ]) || isset ($ trace [$ i ]['class ' ])) {
5551 $ class = isset ($ trace [$ i ]['object ' ]) ? get_class ($ trace [$ i ]['object ' ]) : $ trace [$ i ]['class ' ];
5652 $ method = $ trace [$ i ]['function ' ];
5753
58- $ group = 0 === strpos ($ method , 'testLegacy ' ) || 0 === strpos ($ method , 'provideLegacy ' ) || 0 === strpos ($ method , 'getLegacy ' ) || strpos ($ class , '\Legacy ' ) || in_array ('legacy ' , \PHPUnit_Util_Test::getGroups ($ class , $ method ), true ) ? 'legacy ' : 'remaining ' ;
54+ if (0 !== error_reporting ()) {
55+ $ group = 'unsilenced ' ;
56+ } elseif (0 === strpos ($ method , 'testLegacy ' )
57+ || 0 === strpos ($ method , 'provideLegacy ' )
58+ || 0 === strpos ($ method , 'getLegacy ' )
59+ || strpos ($ class , '\Legacy ' )
60+ || in_array ('legacy ' , \PHPUnit_Util_Test::getGroups ($ class , $ method ), true )
61+ ) {
62+ $ group = 'legacy ' ;
63+ } else {
64+ $ group = 'remaining ' ;
65+ }
66+
67+ if (isset ($ mode [0 ]) && '/ ' === $ mode [0 ] && preg_match ($ mode , $ class .':: ' .$ method )) {
68+ $ e = new \Exception ($ msg );
69+ $ r = new \ReflectionProperty ($ e , 'trace ' );
70+ $ r ->setAccessible (true );
71+ $ r ->setValue ($ e , array_slice ($ trace , 1 , $ i ));
5972
73+ echo "\n" .ucfirst ($ group ).' deprecation triggered by ' .$ class .':: ' .$ method .': ' ;
74+ echo "\n" .$ msg ;
75+ echo "\nStack trace: " ;
76+ echo "\n" .str_replace (' ' .getcwd ().DIRECTORY_SEPARATOR , ' ' , $ e ->getTraceAsString ());
77+ echo "\n" ;
78+
79+ exit (1 );
80+ }
6081 if ('legacy ' !== $ group && 'weak ' !== $ mode ) {
6182 $ ref = &$ deprecations [$ group ][$ msg ]['count ' ];
6283 ++$ ref ;
@@ -78,7 +99,7 @@ public static function register($mode = false)
7899 restore_error_handler ();
79100 self ::register ($ mode );
80101 }
81- } else {
102+ } elseif (! isset ( $ mode [ 0 ]) || ' / ' !== $ mode [ 0 ]) {
82103 self ::$ isRegistered = true ;
83104 if (self ::hasColorSupport ()) {
84105 $ colorize = function ($ str , $ red ) {
0 commit comments