5 |
aurelien |
1 |
<?php
|
|
|
2 |
/**
|
|
|
3 |
* Verifies that control statements conform to their coding standards.
|
|
|
4 |
*
|
|
|
5 |
* PHP version 5
|
|
|
6 |
*
|
|
|
7 |
* @category PHP
|
|
|
8 |
* @package PHP_CodeSniffer
|
|
|
9 |
* @author Greg Sherwood <gsherwood@squiz.net>
|
|
|
10 |
* @author Marc McIntyre <mmcintyre@squiz.net>
|
|
|
11 |
* @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
|
|
|
12 |
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
|
|
|
13 |
* @version CVS: $Id: ControlSignatureSniff.php,v 1.7 2007/10/23 06:05:14 squiz Exp $
|
|
|
14 |
* @link http://pear.php.net/package/PHP_CodeSniffer
|
|
|
15 |
*/
|
|
|
16 |
|
|
|
17 |
if (class_exists('PHP_CodeSniffer_Standards_AbstractPatternSniff', true) === false) {
|
|
|
18 |
throw new PHP_CodeSniffer_Exception('Class PHP_CodeSniffer_Standards_AbstractPatternSniff not found');
|
|
|
19 |
}
|
|
|
20 |
|
|
|
21 |
/**
|
|
|
22 |
* Verifies that control statements conform to their coding standards.
|
|
|
23 |
*
|
|
|
24 |
* @category PHP
|
|
|
25 |
* @package PHP_CodeSniffer
|
|
|
26 |
* @author Greg Sherwood <gsherwood@squiz.net>
|
|
|
27 |
* @author Marc McIntyre <mmcintyre@squiz.net>
|
|
|
28 |
* @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
|
|
|
29 |
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
|
|
|
30 |
* @version Release: 1.2.0RC1
|
|
|
31 |
* @link http://pear.php.net/package/PHP_CodeSniffer
|
|
|
32 |
*/
|
|
|
33 |
class PEAR_Sniffs_ControlStructures_ControlSignatureSniff extends PHP_CodeSniffer_Standards_AbstractPatternSniff
|
|
|
34 |
{
|
|
|
35 |
|
|
|
36 |
|
|
|
37 |
/**
|
|
|
38 |
* Constructs a PEAR_Sniffs_ControlStructures_ControlSignatureSniff.
|
|
|
39 |
*/
|
|
|
40 |
public function __construct()
|
|
|
41 |
{
|
|
|
42 |
parent::__construct(true);
|
|
|
43 |
|
|
|
44 |
}//end __construct()
|
|
|
45 |
|
|
|
46 |
|
|
|
47 |
/**
|
|
|
48 |
* Returns the patterns that this test wishes to verify.
|
|
|
49 |
*
|
|
|
50 |
* @return array(string)
|
|
|
51 |
*/
|
|
|
52 |
protected function getPatterns()
|
|
|
53 |
{
|
|
|
54 |
return array(
|
|
|
55 |
'do {EOL...} while (...);EOL',
|
|
|
56 |
'while (...) {EOL',
|
|
|
57 |
'for (...) {EOL',
|
|
|
58 |
'if (...) {EOL',
|
|
|
59 |
'foreach (...) {EOL',
|
|
|
60 |
'} else if (...) {EOL',
|
|
|
61 |
'} elseif (...) {EOL',
|
|
|
62 |
'} else {EOL',
|
|
|
63 |
'do {EOL',
|
|
|
64 |
);
|
|
|
65 |
|
|
|
66 |
}//end getPatterns()
|
|
|
67 |
|
|
|
68 |
|
|
|
69 |
}//end class
|
|
|
70 |
|
|
|
71 |
?>
|