1 | <?php |
||
25 | class CodingStandard_Sniffs_Classes_ClassNamespaceSniff implements PHP_CodeSniffer_Sniff |
||
|
|||
26 | { |
||
27 | |||
28 | |||
29 | /** |
||
30 | * Returns an array of tokens this test wants to listen for. |
||
31 | * |
||
32 | * @return array |
||
33 | */ |
||
34 | 1 | public function register() |
|
35 | { |
||
36 | // @codeCoverageIgnoreStart |
||
37 | if (version_compare(PHP_VERSION, '5.3.0') < 0) { |
||
38 | return array(); |
||
39 | } |
||
40 | // @codeCoverageIgnoreEnd |
||
41 | |||
42 | return array( |
||
43 | 1 | T_CLASS, |
|
44 | 1 | T_INTERFACE, |
|
45 | 1 | T_TRAIT, |
|
46 | 1 | ); |
|
47 | |||
48 | }//end register() |
||
49 | |||
50 | |||
51 | /** |
||
52 | * Processes this test, when one of its tokens is encountered. |
||
53 | * |
||
54 | * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
||
55 | * @param integer $stackPtr The position of the current token in the |
||
56 | * stack passed in $tokens. |
||
57 | * |
||
58 | * @return void |
||
59 | */ |
||
60 | 1 | public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
|
72 | |||
73 | |||
74 | }//end class |
||
75 |
Classes in PHP are usually named in CamelCase.
In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. The whole name starts with a capital letter as well.
Thus the name database provider becomes
DatabaseProvider
.