1 | <?php |
||
17 | class PHPCompatibility_Sniffs_PHP_NewHashAlgorithmsSniff extends PHPCompatibility_AbstractNewFeatureSniff |
||
|
|||
18 | { |
||
19 | /** |
||
20 | * A list of new hash algorithms, not present in older versions. |
||
21 | * |
||
22 | * The array lists : version number with false (not present) or true (present). |
||
23 | * If's sufficient to list the first version where the hash algorithm appears. |
||
24 | * |
||
25 | * @var array(string => array(string => bool)) |
||
26 | */ |
||
27 | protected $newAlgorithms = array( |
||
28 | 'md2' => array( |
||
29 | '5.2' => false, |
||
30 | '5.3' => true, |
||
31 | ), |
||
32 | 'ripemd256' => array( |
||
33 | '5.2' => false, |
||
34 | '5.3' => true, |
||
35 | ), |
||
36 | 'ripemd320' => array( |
||
37 | '5.2' => false, |
||
38 | '5.3' => true, |
||
39 | ), |
||
40 | 'salsa10' => array( |
||
41 | '5.2' => false, |
||
42 | '5.3' => true, |
||
43 | ), |
||
44 | 'salsa20' => array( |
||
45 | '5.2' => false, |
||
46 | '5.3' => true, |
||
47 | ), |
||
48 | 'snefru256' => array( |
||
49 | '5.2' => false, |
||
50 | '5.3' => true, |
||
51 | ), |
||
52 | 'sha224' => array( |
||
53 | '5.2' => false, |
||
54 | '5.3' => true, |
||
55 | ), |
||
56 | 'joaat' => array( |
||
57 | '5.3' => false, |
||
58 | '5.4' => true, |
||
59 | ), |
||
60 | 'fnv132' => array( |
||
61 | '5.3' => false, |
||
62 | '5.4' => true, |
||
63 | ), |
||
64 | 'fnv164' => array( |
||
65 | '5.3' => false, |
||
66 | '5.4' => true, |
||
67 | ), |
||
68 | 'gost-crypto' => array( |
||
69 | '5.5' => false, |
||
70 | '5.6' => true, |
||
71 | ), |
||
72 | ); |
||
73 | |||
74 | |||
75 | /** |
||
76 | * Returns an array of tokens this test wants to listen for. |
||
77 | * |
||
78 | * @return array |
||
79 | */ |
||
80 | public function register() |
||
85 | |||
86 | |||
87 | /** |
||
88 | * Processes this test, when one of its tokens is encountered. |
||
89 | * |
||
90 | * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
||
91 | * @param int $stackPtr The position of the current token in the |
||
92 | * stack passed in $tokens. |
||
93 | * |
||
94 | * @return void |
||
95 | */ |
||
96 | public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
||
115 | |||
116 | |||
117 | /** |
||
118 | * Get the relevant sub-array for a specific item from a multi-dimensional array. |
||
119 | * |
||
120 | * @param array $itemInfo Base information about the item. |
||
121 | * |
||
122 | * @return array Version and other information about the item. |
||
123 | */ |
||
124 | public function getItemArray(array $itemInfo) |
||
128 | |||
129 | |||
130 | /** |
||
131 | * Get the error message template for this sniff. |
||
132 | * |
||
133 | * @return string |
||
134 | */ |
||
135 | protected function getErrorMsgTemplate() |
||
139 | |||
140 | |||
141 | }//end class |
||
142 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.