--- /usr/share/php/PHP/CodeSniffer/File.php 2009-04-17 06:29:12.000000000 -0700
+++ File.php 2009-04-17 06:28:59.000000000 -0700
@@ -1094,12 +1094,16 @@ class PHP_CodeSniffer_File
$eolChar,
$stackPtr,
$depth=1,
- &$ignore=0
+ &$ignore=0,
+ &$ignoreByDepth=array()
) {
$opener = null;
$currType = $tokens[$stackPtr]['code'];
$startLine = $tokens[$stackPtr]['line'];
-
+ if (!array_key_exists($depth, $ignoreByDepth)) {
+ $ignoreByDepth[$depth] = 0;
+ }
+
// If the start token for this scope opener is the same as
// the scope token, we have already found our opener.
if ($currType === $tokenizer->scopeOpeners[$currType]['start']) {
@@ -1192,7 +1196,8 @@ class PHP_CodeSniffer_File
$eolChar,
$i,
($depth + 1),
- $ignore
+ $ignore,
+ $ignoreByDepth
);
if ($tokenizer->scopeOpeners[$tokenType]['end'] === T_CLOSE_CURLY_BRACKET) {
@@ -1223,6 +1228,7 @@ class PHP_CodeSniffer_File
}
$ignore++;
+ $ignoreByDepth[$depth]++;
}//end if
break;
@@ -1252,6 +1258,7 @@ class PHP_CodeSniffer_File
}
$ignore--;
+ $ignoreByDepth[$depth]--;
} else {
if (PHP_CODESNIFFER_VERBOSITY > 1) {
$type = $tokens[$stackPtr]['type'];
@@ -1264,7 +1271,8 @@ class PHP_CodeSniffer_File
$tokens[$token]['scope_opener'] = $opener;
$tokens[$token]['scope_closer'] = $i;
}
-
+ $ignore -= $ignoreByDepth[$depth];
+ $ignoreByDepth[$depth] = 0;
if ($tokenizer->scopeOpeners[$tokens[$stackPtr]['code']]['shared'] === true) {
return $opener;
} else {
@@ -1305,6 +1313,7 @@ class PHP_CodeSniffer_File
}
$ignore++;
+ $ignoreByDepth[$depth]++;
} else if ($opener === null
&& isset($tokenizer->scopeOpeners[$currType]) === true
) {
@@ -1342,6 +1351,7 @@ class PHP_CodeSniffer_File
}
$ignore--;
+ $ignoreByDepth[$depth]--;
} else {
// We found a token that closes the scope but it doesn't
// have a condition, so it belongs to another token and