| @@ 2005-2010 (lines=6) @@ | ||
| 2002 | $opener, |
|
| 2003 | ); |
|
| 2004 | ||
| 2005 | if (PHP_CODESNIFFER_VERBOSITY > 1) { |
|
| 2006 | $type = $tokens[$stackPtr]['type']; |
|
| 2007 | $closerType = $tokens[$scopeCloser]['type']; |
|
| 2008 | echo str_repeat("\t", $depth); |
|
| 2009 | echo "=> Found scope closer ($scopeCloser:$closerType) for $stackPtr:$type".PHP_EOL; |
|
| 2010 | } |
|
| 2011 | ||
| 2012 | $validCloser = true; |
|
| 2013 | if (($tokens[$stackPtr]['code'] === T_IF || $tokens[$stackPtr]['code'] === T_ELSEIF) |
|
| @@ 2040-2045 (lines=6) @@ | ||
| 2037 | } |
|
| 2038 | } else if ($tokens[$tokens[$scopeCloser]['scope_opener']]['code'] !== $tokens[$opener]['code']) { |
|
| 2039 | $validCloser = false; |
|
| 2040 | if (PHP_CODESNIFFER_VERBOSITY > 1) { |
|
| 2041 | echo str_repeat("\t", $depth); |
|
| 2042 | $type = $tokens[$tokens[$scopeCloser]['scope_opener']]['type']; |
|
| 2043 | $openerType = $tokens[$opener]['type']; |
|
| 2044 | echo "* closer is not valid (mismatched opener type; $type != $openerType) *".PHP_EOL; |
|
| 2045 | } |
|
| 2046 | } else if (PHP_CODESNIFFER_VERBOSITY > 1) { |
|
| 2047 | echo str_repeat("\t", $depth); |
|
| 2048 | echo "* closer was valid *".PHP_EOL; |
|
| @@ 2342-2347 (lines=6) @@ | ||
| 2339 | && isset(PHP_CodeSniffer_Tokens::$emptyTokens[$tokens[($i - 1)]['code']]) === false |
|
| 2340 | ) { |
|
| 2341 | if ($tokenizer->scopeOpeners[$currType]['strict'] === true) { |
|
| 2342 | if (PHP_CODESNIFFER_VERBOSITY > 1) { |
|
| 2343 | $type = $tokens[$stackPtr]['type']; |
|
| 2344 | $lines = ($tokens[$i]['line'] - $startLine); |
|
| 2345 | echo str_repeat("\t", $depth); |
|
| 2346 | echo "=> Still looking for $stackPtr:$type scope opener after $lines lines".PHP_EOL; |
|
| 2347 | } |
|
| 2348 | } else { |
|
| 2349 | if (PHP_CODESNIFFER_VERBOSITY > 1) { |
|
| 2350 | $type = $tokens[$stackPtr]['type']; |
|
| @@ 1033-1039 (lines=7) @@ | ||
| 1030 | $classStack = array(); |
|
| 1031 | ||
| 1032 | for ($i = 0; $i < $numTokens; $i++) { |
|
| 1033 | if (PHP_CODESNIFFER_VERBOSITY > 1) { |
|
| 1034 | $type = $tokens[$i]['type']; |
|
| 1035 | $content = PHP_CodeSniffer::prepareForOutput($tokens[$i]['content']); |
|
| 1036 | ||
| 1037 | echo str_repeat("\t", count($classStack)); |
|
| 1038 | echo "\tProcess token $i: $type => $content".PHP_EOL; |
|
| 1039 | } |
|
| 1040 | ||
| 1041 | // Looking for functions that are actually closures. |
|
| 1042 | if ($tokens[$i]['code'] === T_FUNCTION && isset($tokens[$i]['scope_opener']) === true) { |
|
| @@ 1219-1224 (lines=6) @@ | ||
| 1216 | $closer = $tokens[$i]['bracket_closer']; |
|
| 1217 | $tokens[$closer]['code'] = T_CLOSE_SHORT_ARRAY; |
|
| 1218 | $tokens[$closer]['type'] = 'T_CLOSE_SHORT_ARRAY'; |
|
| 1219 | if (PHP_CODESNIFFER_VERBOSITY > 1) { |
|
| 1220 | $line = $tokens[$i]['line']; |
|
| 1221 | echo "\t* token $i on line $line changed from T_OPEN_SQUARE_BRACKET to T_OPEN_SHORT_ARRAY".PHP_EOL; |
|
| 1222 | $line = $tokens[$closer]['line']; |
|
| 1223 | echo "\t* token $closer on line $line changed from T_CLOSE_SQUARE_BRACKET to T_CLOSE_SHORT_ARRAY".PHP_EOL; |
|
| 1224 | } |
|
| 1225 | } |
|
| 1226 | ||
| 1227 | continue; |
|