Created
October 2, 2013 18:32
-
-
Save morganestes/6798352 to your computer and use it in GitHub Desktop.
PHPTidy bug report for switches
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Starting at line 1577 in v2.11 | |
| // Remove lines 1577-1593 to get result in switch-modified.php | |
| if ( | |
| isset($tokens[$key+1]) and | |
| is_array($tokens[$key+1]) and ( | |
| $tokens[$key+1][0] === T_CASE or | |
| $tokens[$key+1][0] === T_DEFAULT or ( | |
| isset($tokens[$key+2]) and | |
| is_array($tokens[$key+2]) and ( | |
| $tokens[$key+2][0] === T_CASE or | |
| $tokens[$key+2][0] === T_DEFAULT | |
| ) and | |
| // T_WHITESPACE without \n first | |
| $tokens[$key+1][0] === T_WHITESPACE and | |
| strpos($tokens[$key+1][1], "\n")===false | |
| ) | |
| ) | |
| ) $indent++; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| switch ($type) { | |
| case 'month': | |
| $months = array( | |
| 1 => 'Jan', | |
| 2 => 'Feb', | |
| 3 => 'Mar', | |
| 4 => 'Apr', | |
| 5 => 'May', | |
| 6 => 'June', | |
| 7 => 'July', | |
| 8 => 'Aug', | |
| 9 => 'Sept', | |
| 10 => 'Oct', | |
| 11 => 'Nov', | |
| 12 => 'Dec', | |
| ); | |
| $select .= '<option>Month</option>' . PHP_EOL; | |
| for ($month = 1; $month <= 12; $month ++) { | |
| $month_name = $months[$month]; | |
| $month = sprintf("%02s", $month); | |
| $select .= "<option value='$month'>$month — $month_name</option>" . PHP_EOL; | |
| } | |
| break; | |
| case 'year': | |
| $select .= '<option>Year</option>' . PHP_EOL; | |
| $this_year = date('Y'); | |
| for ($year = $this_year; $year <= $this_year + 12; $year++) { | |
| $select .= "<option value='$year'>$year</option>" . PHP_EOL; | |
| } | |
| break; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| switch ($type) { | |
| case 'month': | |
| $months = array( | |
| 1 => 'Jan', | |
| 2 => 'Feb', | |
| 3 => 'Mar', | |
| 4 => 'Apr', | |
| 5 => 'May', | |
| 6 => 'June', | |
| 7 => 'July', | |
| 8 => 'Aug', | |
| 9 => 'Sept', | |
| 10 => 'Oct', | |
| 11 => 'Nov', | |
| 12 => 'Dec', | |
| ); | |
| $select .= '<option>Month</option>' . PHP_EOL; | |
| for ($month = 1; $month <= 12; $month ++) { | |
| $month_name = $months[$month]; | |
| $month = sprintf("%02s", $month); | |
| $select .= "<option value='$month'>$month — $month_name</option>" . PHP_EOL; | |
| } | |
| break; | |
| case 'year': | |
| $select .= '<option>Year</option>' . PHP_EOL; | |
| $this_year = date('Y'); | |
| for ($year = $this_year; $year <= $this_year + 12; $year++) { | |
| $select .= "<option value='$year'>$year</option>" . PHP_EOL; | |
| } | |
| break; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| switch ($type) { | |
| case 'month': | |
| $months = array( | |
| 1 => 'Jan', | |
| 2 => 'Feb', | |
| 3 => 'Mar', | |
| 4 => 'Apr', | |
| 5 => 'May', | |
| 6 => 'June', | |
| 7 => 'July', | |
| 8 => 'Aug', | |
| 9 => 'Sept', | |
| 10 => 'Oct', | |
| 11 => 'Nov', | |
| 12 => 'Dec', | |
| ); | |
| $select .= '<option>Month</option>' . PHP_EOL; | |
| for ($month = 1; $month <= 12; $month ++) { | |
| $month_name = $months[$month]; | |
| $month = sprintf("%02s", $month); | |
| $select .= "<option value='$month'>$month — $month_name</option>" . PHP_EOL; | |
| } | |
| break; | |
| case 'year': | |
| $select .= '<option>Year</option>' . PHP_EOL; | |
| $this_year = date('Y'); | |
| for ($year = $this_year; $year <= $this_year + 12; $year++) { | |
| $select .= "<option value='$year'>$year</option>" . PHP_EOL; | |
| } | |
| break; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment