| @@ 1105-1134 (lines=30) @@ | ||
| 1102 | echo "* shared closer, cleaning up $badToken:$type *".PHP_EOL; |
|
| 1103 | } |
|
| 1104 | ||
| 1105 | for ($x = $this->tokens[$i]['scope_condition']; $x <= $i; $x++) { |
|
| 1106 | $oldConditions = $this->tokens[$x]['conditions']; |
|
| 1107 | $oldLevel = $this->tokens[$x]['level']; |
|
| 1108 | $this->tokens[$x]['level']--; |
|
| 1109 | unset($this->tokens[$x]['conditions'][$badToken]); |
|
| 1110 | if (PHP_CodeSniffer_VERBOSITY > 1) { |
|
| 1111 | $type = $this->tokens[$x]['type']; |
|
| 1112 | $oldConds = ''; |
|
| 1113 | foreach ($oldConditions as $condition) { |
|
| 1114 | $oldConds .= token_name($condition).','; |
|
| 1115 | } |
|
| 1116 | ||
| 1117 | $oldConds = rtrim($oldConds, ','); |
|
| 1118 | ||
| 1119 | $newConds = ''; |
|
| 1120 | foreach ($this->tokens[$x]['conditions'] as $condition) { |
|
| 1121 | $newConds .= token_name($condition).','; |
|
| 1122 | } |
|
| 1123 | ||
| 1124 | $newConds = rtrim($newConds, ','); |
|
| 1125 | ||
| 1126 | $newLevel = $this->tokens[$x]['level']; |
|
| 1127 | echo str_repeat("\t", ($level + 1)); |
|
| 1128 | echo "* cleaned $x:$type *".PHP_EOL; |
|
| 1129 | echo str_repeat("\t", ($level + 2)); |
|
| 1130 | echo "=> level changed from $oldLevel to $newLevel".PHP_EOL; |
|
| 1131 | echo str_repeat("\t", ($level + 2)); |
|
| 1132 | echo "=> conditions changed from $oldConds to $newConds".PHP_EOL; |
|
| 1133 | }//end if |
|
| 1134 | }//end for |
|
| 1135 | ||
| 1136 | unset($conditions[$badToken]); |
|
| 1137 | if (PHP_CodeSniffer_VERBOSITY > 1) { |
|
| @@ 1207-1236 (lines=30) @@ | ||
| 1204 | echo "* scope closer was bad, cleaning up $badToken:$type *".PHP_EOL; |
|
| 1205 | } |
|
| 1206 | ||
| 1207 | for ($x = ($oldOpener + 1); $x <= $i; $x++) { |
|
| 1208 | $oldConditions = $this->tokens[$x]['conditions']; |
|
| 1209 | $oldLevel = $this->tokens[$x]['level']; |
|
| 1210 | $this->tokens[$x]['level']--; |
|
| 1211 | unset($this->tokens[$x]['conditions'][$badToken]); |
|
| 1212 | if (PHP_CodeSniffer_VERBOSITY > 1) { |
|
| 1213 | $type = $this->tokens[$x]['type']; |
|
| 1214 | $oldConds = ''; |
|
| 1215 | foreach ($oldConditions as $condition) { |
|
| 1216 | $oldConds .= token_name($condition).','; |
|
| 1217 | } |
|
| 1218 | ||
| 1219 | $oldConds = rtrim($oldConds, ','); |
|
| 1220 | ||
| 1221 | $newConds = ''; |
|
| 1222 | foreach ($this->tokens[$x]['conditions'] as $condition) { |
|
| 1223 | $newConds .= token_name($condition).','; |
|
| 1224 | } |
|
| 1225 | ||
| 1226 | $newConds = rtrim($newConds, ','); |
|
| 1227 | ||
| 1228 | $newLevel = $this->tokens[$x]['level']; |
|
| 1229 | echo str_repeat("\t", ($level + 1)); |
|
| 1230 | echo "* cleaned $x:$type *".PHP_EOL; |
|
| 1231 | echo str_repeat("\t", ($level + 2)); |
|
| 1232 | echo "=> level changed from $oldLevel to $newLevel".PHP_EOL; |
|
| 1233 | echo str_repeat("\t", ($level + 2)); |
|
| 1234 | echo "=> conditions changed from $oldConds to $newConds".PHP_EOL; |
|
| 1235 | }//end if |
|
| 1236 | }//end for |
|
| 1237 | }//end if |
|
| 1238 | }//end if |
|
| 1239 | ||