|
@@ 2455-2459 (lines=5) @@
|
| 2452 |
|
// Check to see if this token opened the scope. |
| 2453 |
|
if ($tokens[$i]['scope_opener'] === $i) { |
| 2454 |
|
$stackPtr = $tokens[$i]['scope_condition']; |
| 2455 |
|
if (PHP_CODESNIFFER_VERBOSITY > 1) { |
| 2456 |
|
$type = $tokens[$stackPtr]['type']; |
| 2457 |
|
echo str_repeat("\t", ($level + 1)); |
| 2458 |
|
echo "=> Found scope opener for $stackPtr:$type".PHP_EOL; |
| 2459 |
|
} |
| 2460 |
|
|
| 2461 |
|
$stackPtr = $tokens[$i]['scope_condition']; |
| 2462 |
|
|
|
@@ 2485-2489 (lines=5) @@
|
| 2482 |
|
|
| 2483 |
|
if ($isShared === true && $sameEnd === true) { |
| 2484 |
|
$badToken = $opener; |
| 2485 |
|
if (PHP_CODESNIFFER_VERBOSITY > 1) { |
| 2486 |
|
$type = $tokens[$badToken]['type']; |
| 2487 |
|
echo str_repeat("\t", ($level + 1)); |
| 2488 |
|
echo "* shared closer, cleaning up $badToken:$type *".PHP_EOL; |
| 2489 |
|
} |
| 2490 |
|
|
| 2491 |
|
for ($x = $tokens[$i]['scope_condition']; $x <= $i; $x++) { |
| 2492 |
|
$oldConditions = $tokens[$x]['conditions']; |
|
@@ 2523-2527 (lines=5) @@
|
| 2520 |
|
}//end for |
| 2521 |
|
|
| 2522 |
|
unset($conditions[$badToken]); |
| 2523 |
|
if (PHP_CODESNIFFER_VERBOSITY > 1) { |
| 2524 |
|
$type = $tokens[$badToken]['type']; |
| 2525 |
|
echo str_repeat("\t", ($level + 1)); |
| 2526 |
|
echo "* token $badToken:$type removed from conditions array *".PHP_EOL; |
| 2527 |
|
} |
| 2528 |
|
|
| 2529 |
|
unset($openers[$lastOpener]); |
| 2530 |
|
|
|
@@ 2546-2550 (lines=5) @@
|
| 2543 |
|
} |
| 2544 |
|
|
| 2545 |
|
$conditions[$stackPtr] = $tokens[$stackPtr]['code']; |
| 2546 |
|
if (PHP_CODESNIFFER_VERBOSITY > 1) { |
| 2547 |
|
$type = $tokens[$stackPtr]['type']; |
| 2548 |
|
echo str_repeat("\t", ($level + 1)); |
| 2549 |
|
echo "* token $stackPtr:$type added to conditions array *".PHP_EOL; |
| 2550 |
|
} |
| 2551 |
|
|
| 2552 |
|
$lastOpener = $tokens[$i]['scope_opener']; |
| 2553 |
|
if ($lastOpener !== null) { |
|
@@ 2567-2571 (lines=5) @@
|
| 2564 |
|
$lastOpener = null; |
| 2565 |
|
} |
| 2566 |
|
|
| 2567 |
|
if (PHP_CODESNIFFER_VERBOSITY > 1) { |
| 2568 |
|
$type = $tokens[$oldOpener]['type']; |
| 2569 |
|
echo str_repeat("\t", ($level + 1)); |
| 2570 |
|
echo "=> Found scope closer for $oldOpener:$type".PHP_EOL; |
| 2571 |
|
} |
| 2572 |
|
|
| 2573 |
|
$oldCondition = array_pop($conditions); |
| 2574 |
|
if (PHP_CODESNIFFER_VERBOSITY > 1) { |
|
@@ 2587-2591 (lines=5) @@
|
| 2584 |
|
if (isset($tokenizer->scopeOpeners[$oldCondition]['with'][$condition]) === false) { |
| 2585 |
|
$badToken = $tokens[$oldOpener]['scope_condition']; |
| 2586 |
|
|
| 2587 |
|
if (PHP_CODESNIFFER_VERBOSITY > 1) { |
| 2588 |
|
$type = token_name($oldCondition); |
| 2589 |
|
echo str_repeat("\t", ($level + 1)); |
| 2590 |
|
echo "* scope closer was bad, cleaning up $badToken:$type *".PHP_EOL; |
| 2591 |
|
} |
| 2592 |
|
|
| 2593 |
|
for ($x = ($oldOpener + 1); $x <= $i; $x++) { |
| 2594 |
|
$oldConditions = $tokens[$x]['conditions']; |