summaryrefslogtreecommitdiff
path: root/tools/PHP_CodeSniffer/CodeSniffer/Standards/RoundCube/Sniffs/ControlStructures/DisallowPEARIfElseElseifSniff.php
diff options
context:
space:
mode:
Diffstat (limited to 'tools/PHP_CodeSniffer/CodeSniffer/Standards/RoundCube/Sniffs/ControlStructures/DisallowPEARIfElseElseifSniff.php')
-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") {