@@ -112,6 +112,7 @@ public static function getLinesToBeIgnored($filename, $cacheTokens = TRUE)
112112
113113 foreach ($ tokens as $ token ) {
114114 switch (get_class ($ token )) {
115+ case 'PHP_Token_COMMENT ' :
115116 case 'PHP_Token_DOC_COMMENT ' : {
116117 $ count = substr_count ($ token , "\n" );
117118 $ line = $ token ->getLine ();
@@ -125,6 +126,28 @@ public static function getLinesToBeIgnored($filename, $cacheTokens = TRUE)
125126 if (substr (trim ($ lines [$ i -1 ]), -2 ) == '*/ ' ) {
126127 self ::$ ignoredLines [$ filename ][$ i ] = TRUE ;
127128 }
129+
130+ if (!$ token instanceof PHP_Token_COMMENT) {
131+ break ;
132+ }
133+
134+ $ _token = trim ($ token );
135+
136+ if ($ _token == '// @codeCoverageIgnore ' ||
137+ $ _token == '//@codeCoverageIgnore ' ) {
138+ $ ignore = TRUE ;
139+ $ stop = TRUE ;
140+ }
141+
142+ else if ($ _token == '// @codeCoverageIgnoreStart ' ||
143+ $ _token == '//@codeCoverageIgnoreStart ' ) {
144+ $ ignore = TRUE ;
145+ }
146+
147+ else if ($ _token == '// @codeCoverageIgnoreEnd ' ||
148+ $ _token == '//@codeCoverageIgnoreEnd ' ) {
149+ $ stop = TRUE ;
150+ }
128151 }
129152 break ;
130153
@@ -198,27 +221,6 @@ public static function getLinesToBeIgnored($filename, $cacheTokens = TRUE)
198221 self ::$ ignoredLines [$ filename ][$ token ->getLine ()] = TRUE ;
199222 }
200223 break ;
201-
202- case 'PHP_Token_COMMENT ' : {
203- $ _token = trim ($ token );
204-
205- if ($ _token == '// @codeCoverageIgnore ' ||
206- $ _token == '//@codeCoverageIgnore ' ) {
207- $ ignore = TRUE ;
208- $ stop = TRUE ;
209- }
210-
211- else if ($ _token == '// @codeCoverageIgnoreStart ' ||
212- $ _token == '//@codeCoverageIgnoreStart ' ) {
213- $ ignore = TRUE ;
214- }
215-
216- else if ($ _token == '// @codeCoverageIgnoreEnd ' ||
217- $ _token == '//@codeCoverageIgnoreEnd ' ) {
218- $ stop = TRUE ;
219- }
220- }
221- break ;
222224 }
223225
224226 if ($ ignore ) {
0 commit comments