summaryrefslogtreecommitdiff
path: root/tools/PHP_CodeSniffer
diff options
context:
space:
mode:
authortill <till@208e9e7b-5314-0410-a742-e7e81cd9613c>2008-05-27 20:04:37 +0000
committertill <till@208e9e7b-5314-0410-a742-e7e81cd9613c>2008-05-27 20:04:37 +0000
commit700918b686c4394a70d520b43057f550f963a424 (patch)
tree7e02613c71f2078dd4f7956d9dc24dc9bcd6d594 /tools/PHP_CodeSniffer
parent043061efb5966bc4409f7b2d8ddfa5b3fb6c5b71 (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
Diffstat (limited to 'tools/PHP_CodeSniffer')
-rw-r--r--tools/PHP_CodeSniffer/CodeSniffer/Standards/RoundCube/Sniffs/ControlStructures/DisallowPEARIfElseElseifSniff.php4
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") {