Permalink
Browse files

Merge branch '1.2'

  • Loading branch information...
2 parents 06c22a0 + f69e9cf commit cdf135d66cf271f70d30bea5338648f7fa19fb19 @sebastianbergmann committed Oct 7, 2012
Showing with 23 additions and 21 deletions.
  1. +23 −21 PHP/CodeCoverage/Util.php
View
@@ -112,6 +112,7 @@ public static function getLinesToBeIgnored($filename, $cacheTokens = TRUE)
foreach ($tokens as $token) {
switch (get_class($token)) {
+ case 'PHP_Token_COMMENT':
case 'PHP_Token_DOC_COMMENT': {
$count = substr_count($token, "\n");
$line = $token->getLine();
@@ -125,6 +126,28 @@ public static function getLinesToBeIgnored($filename, $cacheTokens = TRUE)
if (substr(trim($lines[$i-1]), -2) == '*/') {
self::$ignoredLines[$filename][$i] = TRUE;
}
+
+ if (!$token instanceof PHP_Token_COMMENT) {
+ break;
+ }
+
+ $_token = trim($token);
+
+ if ($_token == '// @codeCoverageIgnore' ||
+ $_token == '//@codeCoverageIgnore') {
+ $ignore = TRUE;
+ $stop = TRUE;
+ }
+
+ else if ($_token == '// @codeCoverageIgnoreStart' ||
+ $_token == '//@codeCoverageIgnoreStart') {
+ $ignore = TRUE;
+ }
+
+ else if ($_token == '// @codeCoverageIgnoreEnd' ||
+ $_token == '//@codeCoverageIgnoreEnd') {
+ $stop = TRUE;
+ }
}
break;
@@ -198,27 +221,6 @@ public static function getLinesToBeIgnored($filename, $cacheTokens = TRUE)
self::$ignoredLines[$filename][$token->getLine()] = TRUE;
}
break;
-
- case 'PHP_Token_COMMENT': {
- $_token = trim($token);
-
- if ($_token == '// @codeCoverageIgnore' ||
- $_token == '//@codeCoverageIgnore') {
- $ignore = TRUE;
- $stop = TRUE;
- }
-
- else if ($_token == '// @codeCoverageIgnoreStart' ||
- $_token == '//@codeCoverageIgnoreStart') {
- $ignore = TRUE;
- }
-
- else if ($_token == '// @codeCoverageIgnoreEnd' ||
- $_token == '//@codeCoverageIgnoreEnd') {
- $stop = TRUE;
- }
- }
- break;
}
if ($ignore) {

0 comments on commit cdf135d

Please sign in to comment.