File tree Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -264,9 +264,12 @@ public static function getLinesToBeIgnored($filename)
264264 if (!isset (self ::$ ignoredLines [$ filename ])) {
265265 self ::$ ignoredLines [$ filename ] = array ();
266266
267- $ ignore = FALSE ;
268- $ stop = FALSE ;
269- $ tokens = PHP_Token_Stream_CachingFactory::get ($ filename )->tokens ();
267+ $ ignore = FALSE ;
268+ $ stop = FALSE ;
269+ $ stream = PHP_Token_Stream_CachingFactory::get ($ filename );
270+ $ tokens = $ stream ->tokens ();
271+ $ classes = $ stream ->getClasses ();
272+ unset($ stream );
270273
271274 foreach ($ tokens as $ token ) {
272275 switch (get_class ($ token )) {
@@ -281,6 +284,17 @@ public static function getLinesToBeIgnored($filename)
281284 self ::$ ignoredLines [$ filename ][$ i ] = TRUE ;
282285 }
283286 }
287+
288+ else if ($ token instanceof PHP_Token_CLASS &&
289+ !empty ($ classes [$ token ->getName ()]['methods ' ])) {
290+ $ firstMethod = array_shift (
291+ $ classes [$ token ->getName ()]['methods ' ]
292+ );
293+
294+ for ($ i = $ token ->getLine (); $ i < $ firstMethod ['startLine ' ]; $ i ++) {
295+ self ::$ ignoredLines [$ filename ][$ i ] = TRUE ;
296+ }
297+ }
284298 }
285299 break ;
286300
Original file line number Diff line number Diff line change @@ -225,6 +225,11 @@ public function testGetLinesToBeIgnored()
225225 14 => TRUE ,
226226 15 => TRUE ,
227227 16 => TRUE ,
228+ 18 => TRUE ,
229+ 19 => TRUE ,
230+ 20 => TRUE ,
231+ 21 => TRUE ,
232+ 22 => TRUE ,
228233 23 => TRUE ,
229234 24 => TRUE ,
230235 25 => TRUE
You can’t perform that action at this time.
0 commit comments