summaryrefslogtreecommitdiff
path: root/tools/PHP_CodeSniffer
diff options
context:
space:
mode:
authortill <till@208e9e7b-5314-0410-a742-e7e81cd9613c>2008-05-27 18:32:28 +0000
committertill <till@208e9e7b-5314-0410-a742-e7e81cd9613c>2008-05-27 18:32:28 +0000
commitb0572f3e5f750aeb782fd2f3dfc2ef5d3d62e302 (patch)
treee44c75b7be3ec79a129b1d8ba329ac89a7153d0a /tools/PHP_CodeSniffer
parent33186e56e3eaa39162a657f5c7a41b55aa7ce414 (diff)
* 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
Diffstat (limited to 'tools/PHP_CodeSniffer')
-rw-r--r--tools/PHP_CodeSniffer/CodeSniffer/Standards/RoundCube/RoundCubeCodingStandard.php34
-rw-r--r--tools/PHP_CodeSniffer/CodeSniffer/Standards/RoundCube/Sniffs/ControlStructures/ControlSignatureSniff.php71
2 files changed, 105 insertions, 0 deletions
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 @@
+<?php
+/**
+ * MyStandard Coding Standard.
+ *
+ * PHP version 5
+ *
+ * @category PHP
+ * @package PHP_CodeSniffer
+ * @author Till Klampaeckel <till@php.net>
+ * @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 <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 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 @@
+<?php
+/**
+ * Verifies that control statements conform to their coding standards.
+ *
+ * PHP version 5
+ *
+ * @category PHP
+ * @package PHP_CodeSniffer
+ * @author Greg Sherwood <gsherwood@squiz.net>
+ * @author Marc McIntyre <mmcintyre@squiz.net>
+ * @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 <gsherwood@squiz.net>
+ * @author Marc McIntyre <mmcintyre@squiz.net>
+ * @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
+
+?>