diff options
| author | till <till@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2008-05-27 19:21:25 +0000 |
|---|---|---|
| committer | till <till@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2008-05-27 19:21:25 +0000 |
| commit | a66a46977faeb401171d591ff43af76304e4216c (patch) | |
| tree | 65aa2d64b31f373de6b423c1803b8f4f408c7b71 /tools/PHP_CodeSniffer | |
| parent | 35d71bbbcd70d3502b90bb65dee78991bb1bea94 (diff) | |
* started working on Sniff to disallow the PEAR-style if/else/elseif
git-svn-id: https://svn.roundcube.net/trunk@1437 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'tools/PHP_CodeSniffer')
| -rw-r--r-- | tools/PHP_CodeSniffer/CodeSniffer/Standards/RoundCube/Sniffs/ControlStructures/DisallowPEARIfElseElseifSniff.php | 73 |
1 files changed, 73 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 new file mode 100644 index 000000000..f13c2a117 --- /dev/null +++ b/tools/PHP_CodeSniffer/CodeSniffer/Standards/RoundCube/Sniffs/ControlStructures/DisallowPEARIfElseElseifSniff.php @@ -0,0 +1,73 @@ +<?php +/** + * PHP_CodeSniffer tokenises PHP code and detects violations of a + * defined set of coding standards. + * + * PHP version 5 + * + * @category PHP + * @package PHP_CodeSniffer + * @author Till Klampaeckel <till@php.net> + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version CVS: $Id: $ + * @link http://pear.php.net/package/PHP_CodeSniffer + */ + +require_once 'PHP/CodeSniffer/Sniff.php'; + +/** + * This sniff prohibits PEAR-style, if/else/elseif + * + * An example of the PEAR-style is: + * + * <code> + * if (...) { + * ... + * } elseif (...) { + * ... + * } else { + * ... + * } + * </code> + * + * @category PHP + * @package PHP_CodeSniffer + * @author Till Klampaeckel <till@php.net> + * @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence + * @version Release: @package_version@ + * @link http://pear.php.net/package/PHP_CodeSniffer + */ +class RoundCube_Sniffs_ControlStructures_DisallowPEARIfElseElseifSniff implements PHP_CodeSniffer_Sniff +{ + + + /** + * Returns the token types that this sniff is interested in. + * + * @return array() + */ + public function register() + { + return array(T_ELSE,T_ELSEIF); + + }//end register() + + + /** + * Processes the tokens that this sniff is interested in. + * + * @param PHP_CodeSniffer_File $phpcsFile The file where the token was found. + * @param int $stackPtr The position in the stack where + * the token was found. + * + * @return void + */ + public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + // NOT YET DONE, WORKING ON IT + + }//end process() + + +}//end class |
