From 700918b686c4394a70d520b43057f550f963a424 Mon Sep 17 00:00:00 2001 From: till Date: Tue, 27 May 2008 20:04:37 +0000 Subject: * added a check for T_WHITESPACE to hopefully optimize 'matching' git-svn-id: https://svn.roundcube.net/trunk@1440 208e9e7b-5314-0410-a742-e7e81cd9613c --- .../Sniffs/ControlStructures/DisallowPEARIfElseElseifSniff.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tools') 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") { -- cgit v1.2.3