summaryrefslogtreecommitdiff
path: root/tools/PHP_CodeSniffer/CodeSniffer
diff options
context:
space:
mode:
Diffstat (limited to 'tools/PHP_CodeSniffer/CodeSniffer')
-rw-r--r--tools/PHP_CodeSniffer/CodeSniffer/Standards/RoundCube/Sniffs/ControlStructures/DisallowPEARIfElseElseifSniff.php21
1 files changed, 18 insertions, 3 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 f13c2a117..377b21d46 100644
--- a/tools/PHP_CodeSniffer/CodeSniffer/Standards/RoundCube/Sniffs/ControlStructures/DisallowPEARIfElseElseifSniff.php
+++ b/tools/PHP_CodeSniffer/CodeSniffer/Standards/RoundCube/Sniffs/ControlStructures/DisallowPEARIfElseElseifSniff.php
@@ -65,9 +65,24 @@ class RoundCube_Sniffs_ControlStructures_DisallowPEARIfElseElseifSniff implement
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
{
$tokens = $phpcsFile->getTokens();
- // NOT YET DONE, WORKING ON IT
-
+ $count = 0;
+ while(true) {
+ $count++;
+ if ($tokens[$stackPtr - 1] === "\n") {
+ break;
+ }
+ if ($tokens[$stackPtr - 1] === "\r") {
+ break;
+ }
+ if ($tokens[$stackPtr - 1] === "\r\n") {
+ break;
+ }
+ if ($count > 3) {
+ $phpcsFile->addError('} else {/} elseif (...) { not allowed.', $stackPtr);
+ return;
+ }
+ }
+ return;
}//end process()
-
}//end class