| @@ 1134-1163 (lines=30) @@ | ||
| 1131 | echo "* shared closer, cleaning up $badToken:$type *".PHP_EOL; |
|
| 1132 | } |
|
| 1133 | ||
| 1134 | for ($x = $this->tokens[$i]['scope_condition']; $x <= $i; $x++) { |
|
| 1135 | $oldConditions = $this->tokens[$x]['conditions']; |
|
| 1136 | $oldLevel = $this->tokens[$x]['level']; |
|
| 1137 | $this->tokens[$x]['level']--; |
|
| 1138 | unset($this->tokens[$x]['conditions'][$badToken]); |
|
| 1139 | if (PHP_CodeSniffer_VERBOSITY > 1) { |
|
| 1140 | $type = $this->tokens[$x]['type']; |
|
| 1141 | $oldConds = ''; |
|
| 1142 | foreach ($oldConditions as $condition) { |
|
| 1143 | $oldConds .= token_name($condition).','; |
|
| 1144 | } |
|
| 1145 | ||
| 1146 | $oldConds = rtrim($oldConds, ','); |
|
| 1147 | ||
| 1148 | $newConds = ''; |
|
| 1149 | foreach ($this->tokens[$x]['conditions'] as $condition) { |
|
| 1150 | $newConds .= token_name($condition).','; |
|
| 1151 | } |
|
| 1152 | ||
| 1153 | $newConds = rtrim($newConds, ','); |
|
| 1154 | ||
| 1155 | $newLevel = $this->tokens[$x]['level']; |
|
| 1156 | echo str_repeat("\t", ($level + 1)); |
|
| 1157 | echo "* cleaned $x:$type *".PHP_EOL; |
|
| 1158 | echo str_repeat("\t", ($level + 2)); |
|
| 1159 | echo "=> level changed from $oldLevel to $newLevel".PHP_EOL; |
|
| 1160 | echo str_repeat("\t", ($level + 2)); |
|
| 1161 | echo "=> conditions changed from $oldConds to $newConds".PHP_EOL; |
|
| 1162 | }//end if |
|
| 1163 | }//end for |
|
| 1164 | ||
| 1165 | unset($conditions[$badToken]); |
|
| 1166 | if (PHP_CodeSniffer_VERBOSITY > 1) { |
|
| @@ 1236-1265 (lines=30) @@ | ||
| 1233 | echo "* scope closer was bad, cleaning up $badToken:$type *".PHP_EOL; |
|
| 1234 | } |
|
| 1235 | ||
| 1236 | for ($x = ($oldOpener + 1); $x <= $i; $x++) { |
|
| 1237 | $oldConditions = $this->tokens[$x]['conditions']; |
|
| 1238 | $oldLevel = $this->tokens[$x]['level']; |
|
| 1239 | $this->tokens[$x]['level']--; |
|
| 1240 | unset($this->tokens[$x]['conditions'][$badToken]); |
|
| 1241 | if (PHP_CodeSniffer_VERBOSITY > 1) { |
|
| 1242 | $type = $this->tokens[$x]['type']; |
|
| 1243 | $oldConds = ''; |
|
| 1244 | foreach ($oldConditions as $condition) { |
|
| 1245 | $oldConds .= token_name($condition).','; |
|
| 1246 | } |
|
| 1247 | ||
| 1248 | $oldConds = rtrim($oldConds, ','); |
|
| 1249 | ||
| 1250 | $newConds = ''; |
|
| 1251 | foreach ($this->tokens[$x]['conditions'] as $condition) { |
|
| 1252 | $newConds .= token_name($condition).','; |
|
| 1253 | } |
|
| 1254 | ||
| 1255 | $newConds = rtrim($newConds, ','); |
|
| 1256 | ||
| 1257 | $newLevel = $this->tokens[$x]['level']; |
|
| 1258 | echo str_repeat("\t", ($level + 1)); |
|
| 1259 | echo "* cleaned $x:$type *".PHP_EOL; |
|
| 1260 | echo str_repeat("\t", ($level + 2)); |
|
| 1261 | echo "=> level changed from $oldLevel to $newLevel".PHP_EOL; |
|
| 1262 | echo str_repeat("\t", ($level + 2)); |
|
| 1263 | echo "=> conditions changed from $oldConds to $newConds".PHP_EOL; |
|
| 1264 | }//end if |
|
| 1265 | }//end for |
|
| 1266 | }//end if |
|
| 1267 | }//end if |
|
| 1268 | ||