@@ -714,22 +714,24 @@ private function getLinesToBeIgnored($filename)
714714 $ stop = true ;
715715 }
716716
717- // Do not ignore the whole line when there is a token
718- // before the comment on the same line
719- if (0 === strpos ($ _token , $ _line )) {
720- $ count = substr_count ($ token , "\n" );
721- $ line = $ token ->getLine ();
717+ if (!$ ignore ) {
718+ $ start = $ token ->getLine ();
719+ $ end = $ start + substr_count ($ token , "\n" );
720+
721+ // Do not ignore the first line when there is a token
722+ // before the comment
723+ if (0 !== strpos ($ _token , $ _line )) {
724+ $ start ++;
725+ }
722726
723- for ($ i = $ line ; $ i < $ line + $ count ; $ i ++) {
727+ for ($ i = $ start ; $ i < $ end ; $ i ++) {
724728 $ this ->ignoredLines [$ filename ][] = $ i ;
725729 }
726730
727- if ($ token instanceof PHP_Token_DOC_COMMENT) {
728- // The DOC_COMMENT token does not contain the
729- // final \n character in its text
730- if (substr (trim ($ lines [$ i -1 ]), -2 ) == '*/ ' ) {
731- $ this ->ignoredLines [$ filename ][] = $ i ;
732- }
731+ // A DOC_COMMENT token or a COMMENT token starting with "/*"
732+ // does not contain the final \n character in its text
733+ if (0 === strpos ($ _token , '/* ' ) && '*/ ' === substr (trim ($ lines [$ i -1 ]), -2 )) {
734+ $ this ->ignoredLines [$ filename ][] = $ i ;
733735 }
734736 }
735737 break ;
0 commit comments