diff options
| author | till <till@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2008-05-27 20:04:37 +0000 |
|---|---|---|
| committer | till <till@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2008-05-27 20:04:37 +0000 |
| commit | 700918b686c4394a70d520b43057f550f963a424 (patch) | |
| tree | 7e02613c71f2078dd4f7956d9dc24dc9bcd6d594 | |
| parent | 043061efb5966bc4409f7b2d8ddfa5b3fb6c5b71 (diff) | |
* added a check for T_WHITESPACE to hopefully optimize 'matching'
git-svn-id: https://svn.roundcube.net/trunk@1440 208e9e7b-5314-0410-a742-e7e81cd9613c
| -rw-r--r-- | tools/PHP_CodeSniffer/CodeSniffer/Standards/RoundCube/Sniffs/ControlStructures/DisallowPEARIfElseElseifSniff.php | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/PHP_CodeSniffer/CodeSniffer/Standards/RoundCube/Sniffs/ControlStructures/DisallowPEARIfElseElseifSniff.php b/tools/PHP_CodeSniffer/CodeSniffer/Standards/RoundCube/Sniffs/ControlStructures/DisallowPEARIfElseElseifSniff.php index 377b21d46..5f6c24f1e 100644 --- a/tools/PHP_CodeSniffer/CodeSniffer/Standards/RoundCube/Sniffs/ControlStructures/DisallowPEARIfElseElseifSniff.php +++ b/tools/PHP_CodeSniffer/CodeSniffer/Standards/RoundCube/Sniffs/ControlStructures/DisallowPEARIfElseElseifSniff.php @@ -66,6 +66,10 @@ class RoundCube_Sniffs_ControlStructures_DisallowPEARIfElseElseifSniff implement { $tokens = $phpcsFile->getTokens(); $count = 0; + if ($tokens[$stackPtr - 1] !== T_WHITESPACE) { + $phpcsFile->addError('} else {/} elseif (...) { not allowed.', $stackPtr); + return; + } while(true) { $count++; if ($tokens[$stackPtr - 1] === "\n") { |
