@@ -140,30 +140,37 @@ public static function getLinesToBeIgnored($filename, $cacheTokens = TRUE)
140140 }
141141
142142 else if (($ token instanceof PHP_Token_TRAIT ||
143- $ token instanceof PHP_Token_CLASS) &&
144- !empty ($ classes [$ token ->getName ()]['methods ' ])) {
145- $ firstMethod = array_shift (
146- $ classes [$ token ->getName ()]['methods ' ]
147- );
148-
149- $ lastMethod = array_pop (
150- $ classes [$ token ->getName ()]['methods ' ]
151- );
152-
153- if ($ lastMethod === NULL ) {
154- $ lastMethod = $ firstMethod ;
155- }
156-
157- for ($ i = $ token ->getLine ();
158- $ i < $ firstMethod ['startLine ' ];
159- $ i ++) {
160- self ::$ ignoredLines [$ filename ][$ i ] = TRUE ;
161- }
162-
163- for ($ i = $ token ->getEndLine ();
164- $ i > $ lastMethod ['endLine ' ];
165- $ i --) {
166- self ::$ ignoredLines [$ filename ][$ i ] = TRUE ;
143+ $ token instanceof PHP_Token_CLASS)) {
144+ if (empty ($ classes [$ token ->getName ()]['methods ' ])) {
145+ for ($ i = $ token ->getLine ();
146+ $ i <= $ token ->getEndLine ();
147+ $ i ++) {
148+ self ::$ ignoredLines [$ filename ][$ i ] = TRUE ;
149+ }
150+ } else {
151+ $ firstMethod = array_shift (
152+ $ classes [$ token ->getName ()]['methods ' ]
153+ );
154+
155+ $ lastMethod = array_pop (
156+ $ classes [$ token ->getName ()]['methods ' ]
157+ );
158+
159+ if ($ lastMethod === NULL ) {
160+ $ lastMethod = $ firstMethod ;
161+ }
162+
163+ for ($ i = $ token ->getLine ();
164+ $ i < $ firstMethod ['startLine ' ];
165+ $ i ++) {
166+ self ::$ ignoredLines [$ filename ][$ i ] = TRUE ;
167+ }
168+
169+ for ($ i = $ token ->getEndLine ();
170+ $ i > $ lastMethod ['endLine ' ];
171+ $ i --) {
172+ self ::$ ignoredLines [$ filename ][$ i ] = TRUE ;
173+ }
167174 }
168175 }
169176 }
0 commit comments