Changeset 1258
- Timestamp:
- 01/18/08 13:48:41 (10 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/php/org/stubbles/codeSniffer/stubbles/sniffs/ControlStructures/stubSwitchDeclarationSniff.php
r1173 r1258 88 88 } 89 89 90 /* 91 * Stubbles (simplified if) 92 */ 93 $caseAhead = $phpcsFile->findNext(T_CASE, $nextCase+1, $switch['scope_closer']); 94 $nextBreak = $phpcsFile->findNext(T_BREAK, ($nextCase + 1), $caseAhead); 95 if ($nextBreak !== false) { 90 $nextBreak = $phpcsFile->findNext(T_BREAK, ($nextCase + 1), $switch['scope_closer']); 91 if ($nextBreak !== false && isset($tokens[$nextBreak]['scope_condition']) === true) { 92 // Only check this BREAK statement if it matches the current CASE 93 // statement. This stops the same break (used for multiple CASEs) being 94 // checked more than once. 96 95 97 96 /* … … 165 164 $phpcsFile->addError($error, $nextBreak); 166 165 } 166 167 167 } else { 168 168 /* … … 177 177 178 178 $caseOrDefaultAhead = $phpcsFile->findNext(array(T_CASE, T_DEFAULT), $nextCase+1, $switch['scope_closer']); 179 if ($tokens[$caseOrDefaultAhead]['type'] !== T_CASE || $tokens[$caseOrDefaultAhead]['type'] !== T_DEFAULT) { 180 // missing default handled below 181 continue; 182 } 183 184 echo $tokens[$caseOrDefaultAhead]['code']; 185 echo $tokens[$caseOrDefaultAhead]['type']; 186 187 188 $requiredComment = "// break ommitted"; 179 180 // echo $tokens[$caseOrDefaultAhead]['code']; 181 // echo $tokens[$caseOrDefaultAhead]['type']; 182 183 $requiredComment = "// break omitted"; 189 184 $next = array( 190 185 'return' => null,
