Skip to content

Commit

Permalink
PHP tokenizer now supports DEFAULT statements opened with a T_SEMICOLON
Browse files Browse the repository at this point in the history
  • Loading branch information
gsherwood committed Feb 23, 2014
1 parent 222ba72 commit 1c861e9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -239,20 +239,20 @@ switch ($foo) {

// Valid SWITCH statement.
switch ($something) {
case '1':
case '1';
$case = '1';
return '1';

case '2':
case '3':
case '2';
case '3';
$case = '5';
return '2';

case '4':
case '4';
$case = '4';
return '3';

default:
default;
$case = null;
return '4';
}
Expand Down
5 changes: 4 additions & 1 deletion CodeSniffer/Tokenizers/PHP.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,10 @@ class PHP_CodeSniffer_Tokenizers_PHP
),
),
T_DEFAULT => array(
'start' => array(T_COLON),
'start' => array(
T_COLON,
T_SEMICOLON,
),
'end' => array(
T_BREAK,
T_RETURN,
Expand Down
1 change: 1 addition & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
- Custom reports can now specify a $recordErrors member var; this previously only worked for built-in reports
-- When set to FALSE, error messages will not be recorded and only totals will be returned
-- This can save significant memory while processing a large code base
- PHP tokenizer now supports DEFAULT statements opened with a T_SEMICOLON
- The Squiz and PHPCS standards have increased the max padding for statement alignment from 8 to 12
- Squiz EchoedStringsSniff now supports statments without a semicolon, such as PHP embedded in HTML
- Squiz DoubleQuoteUsageSniff now properly replaces escaped double quotes when fixing a doubled quoted string
Expand Down

0 comments on commit 1c861e9

Please sign in to comment.