| @@ 2491-2520 (lines=30) @@ | ||
| 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']; |
|
| 2493 | $oldLevel = $tokens[$x]['level']; |
|
| 2494 | $tokens[$x]['level']--; |
|
| 2495 | unset($tokens[$x]['conditions'][$badToken]); |
|
| 2496 | if (PHP_CODESNIFFER_VERBOSITY > 1) { |
|
| 2497 | $type = $tokens[$x]['type']; |
|
| 2498 | $oldConds = ''; |
|
| 2499 | foreach ($oldConditions as $condition) { |
|
| 2500 | $oldConds .= token_name($condition).','; |
|
| 2501 | } |
|
| 2502 | ||
| 2503 | $oldConds = rtrim($oldConds, ','); |
|
| 2504 | ||
| 2505 | $newConds = ''; |
|
| 2506 | foreach ($tokens[$x]['conditions'] as $condition) { |
|
| 2507 | $newConds .= token_name($condition).','; |
|
| 2508 | } |
|
| 2509 | ||
| 2510 | $newConds = rtrim($newConds, ','); |
|
| 2511 | ||
| 2512 | $newLevel = $tokens[$x]['level']; |
|
| 2513 | echo str_repeat("\t", ($level + 1)); |
|
| 2514 | echo "* cleaned $x:$type *".PHP_EOL; |
|
| 2515 | echo str_repeat("\t", ($level + 2)); |
|
| 2516 | echo "=> level changed from $oldLevel to $newLevel".PHP_EOL; |
|
| 2517 | echo str_repeat("\t", ($level + 2)); |
|
| 2518 | echo "=> conditions changed from $oldConds to $newConds".PHP_EOL; |
|
| 2519 | }//end if |
|
| 2520 | }//end for |
|
| 2521 | ||
| 2522 | unset($conditions[$badToken]); |
|
| 2523 | if (PHP_CODESNIFFER_VERBOSITY > 1) { |
|
| @@ 2593-2622 (lines=30) @@ | ||
| 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']; |
|
| 2595 | $oldLevel = $tokens[$x]['level']; |
|
| 2596 | $tokens[$x]['level']--; |
|
| 2597 | unset($tokens[$x]['conditions'][$badToken]); |
|
| 2598 | if (PHP_CODESNIFFER_VERBOSITY > 1) { |
|
| 2599 | $type = $tokens[$x]['type']; |
|
| 2600 | $oldConds = ''; |
|
| 2601 | foreach ($oldConditions as $condition) { |
|
| 2602 | $oldConds .= token_name($condition).','; |
|
| 2603 | } |
|
| 2604 | ||
| 2605 | $oldConds = rtrim($oldConds, ','); |
|
| 2606 | ||
| 2607 | $newConds = ''; |
|
| 2608 | foreach ($tokens[$x]['conditions'] as $condition) { |
|
| 2609 | $newConds .= token_name($condition).','; |
|
| 2610 | } |
|
| 2611 | ||
| 2612 | $newConds = rtrim($newConds, ','); |
|
| 2613 | ||
| 2614 | $newLevel = $tokens[$x]['level']; |
|
| 2615 | echo str_repeat("\t", ($level + 1)); |
|
| 2616 | echo "* cleaned $x:$type *".PHP_EOL; |
|
| 2617 | echo str_repeat("\t", ($level + 2)); |
|
| 2618 | echo "=> level changed from $oldLevel to $newLevel".PHP_EOL; |
|
| 2619 | echo str_repeat("\t", ($level + 2)); |
|
| 2620 | echo "=> conditions changed from $oldConds to $newConds".PHP_EOL; |
|
| 2621 | }//end if |
|
| 2622 | }//end for |
|
| 2623 | }//end if |
|
| 2624 | }//end if |
|
| 2625 | ||