From b0572f3e5f750aeb782fd2f3dfc2ef5d3d62e302 Mon Sep 17 00:00:00 2001 From: till Date: Tue, 27 May 2008 18:32:28 +0000 Subject: * initial check in tools and structure for RoundCube standard based on PHP_CodeSniffer git-svn-id: https://svn.roundcube.net/trunk@1435 208e9e7b-5314-0410-a742-e7e81cd9613c --- .../RoundCube/RoundCubeCodingStandard.php | 34 +++++++++++ .../ControlStructures/ControlSignatureSniff.php | 71 ++++++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 tools/PHP_CodeSniffer/CodeSniffer/Standards/RoundCube/RoundCubeCodingStandard.php create mode 100644 tools/PHP_CodeSniffer/CodeSniffer/Standards/RoundCube/Sniffs/ControlStructures/ControlSignatureSniff.php (limited to 'tools') diff --git a/tools/PHP_CodeSniffer/CodeSniffer/Standards/RoundCube/RoundCubeCodingStandard.php b/tools/PHP_CodeSniffer/CodeSniffer/Standards/RoundCube/RoundCubeCodingStandard.php new file mode 100644 index 000000000..5b6dbf3cb --- /dev/null +++ b/tools/PHP_CodeSniffer/CodeSniffer/Standards/RoundCube/RoundCubeCodingStandard.php @@ -0,0 +1,34 @@ + + * @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence + * @version CVS: $Id: $ + * @link http://pear.php.net/package/PHP_CodeSniffer + */ + +require_once 'PHP/CodeSniffer/Standards/CodingStandard.php'; + +/** + * RoundCube Standard. + * + * @category PHP + * @package PHP_CodeSniffer + * @author Till Klampaeckel + * @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 PHP_CodeSniffer_Standards_RoundCube_RoundCubeCodingStandard extends PHP_CodeSniffer_Standards_CodingStandard +{ + public function getIncludedSniffs() + { + return array('PEAR'); + } + +}//end class diff --git a/tools/PHP_CodeSniffer/CodeSniffer/Standards/RoundCube/Sniffs/ControlStructures/ControlSignatureSniff.php b/tools/PHP_CodeSniffer/CodeSniffer/Standards/RoundCube/Sniffs/ControlStructures/ControlSignatureSniff.php new file mode 100644 index 000000000..c23a998f6 --- /dev/null +++ b/tools/PHP_CodeSniffer/CodeSniffer/Standards/RoundCube/Sniffs/ControlStructures/ControlSignatureSniff.php @@ -0,0 +1,71 @@ + + * @author Marc McIntyre + * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600) + * @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence + * @version CVS: $Id: $ + * @link http://pear.php.net/package/PHP_CodeSniffer + */ + +if (class_exists('PHP_CodeSniffer_Standards_AbstractPatternSniff', true) === false) { + throw new PHP_CodeSniffer_Exception('Class PHP_CodeSniffer_Standards_AbstractPatternSniff not found'); +} + +/** + * Verifies that control statements conform to their coding standards. + * + * @category PHP + * @package PHP_CodeSniffer + * @author Greg Sherwood + * @author Marc McIntyre + * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600) + * @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_ControlSignatureSniff extends PHP_CodeSniffer_Standards_AbstractPatternSniff +{ + + + /** + * Constructs a RoundCube_Sniffs_ControlStructures_ControlSignatureSniff. + */ + public function __construct() + { + parent::__construct(true); + + }//end __construct() + + + /** + * Returns the patterns that this test wishes to verify. + * + * @return array(string) + */ + protected function getPatterns() + { + return array( + 'do {EOL...} while (...);EOL', + 'while (...) {EOL', + 'for (...) {EOL', + 'if (...) {EOL', + 'foreach (...) {EOL', + '}EOL else if (...) {EOL', + '}EOL elseif (...) {EOL', + '}EOL else {EOL', + 'do {EOL', + ); + + }//end getPatterns() + + +}//end class + +?> -- cgit v1.2.3