1 | <?php |
||
19 | class PHPCompatibility_Sniffs_PHP_NewInterfacesSniff |
||
|
|||
20 | extends PHPCompatibility_AbstractNewFeatureSniff |
||
21 | { |
||
22 | |||
23 | /** |
||
24 | * A list of new interfaces, not present in older versions. |
||
25 | * |
||
26 | * The array lists : version number with false (not present) or true (present). |
||
27 | * If's sufficient to list the first version where the interface appears. |
||
28 | * |
||
29 | * @var array(string => array(string => int|string|null)) |
||
30 | */ |
||
31 | protected $newInterfaces = array( |
||
32 | 'Countable' => array( |
||
33 | '5.0' => false, |
||
34 | '5.1' => true |
||
35 | ), |
||
36 | 'OuterIterator' => array( |
||
37 | '5.0' => false, |
||
38 | '5.1' => true |
||
39 | ), |
||
40 | 'RecursiveIterator' => array( |
||
41 | '5.0' => false, |
||
42 | '5.1' => true |
||
43 | ), |
||
44 | 'SeekableIterator' => array( |
||
45 | '5.0' => false, |
||
46 | '5.1' => true |
||
47 | ), |
||
48 | 'Serializable' => array( |
||
49 | '5.0' => false, |
||
50 | '5.1' => true, |
||
51 | ), |
||
52 | 'SplObserver' => array( |
||
53 | '5.0' => false, |
||
54 | '5.1' => true |
||
55 | ), |
||
56 | 'SplSubject' => array( |
||
57 | '5.0' => false, |
||
58 | '5.1' => true |
||
59 | ), |
||
60 | |||
61 | 'JsonSerializable' => array( |
||
62 | '5.3' => false, |
||
63 | '5.4' => true |
||
64 | ), |
||
65 | 'SessionHandlerInterface' => array( |
||
66 | '5.3' => false, |
||
67 | '5.4' => true |
||
68 | ), |
||
69 | |||
70 | ); |
||
71 | |||
72 | /** |
||
73 | * A list of methods which cannot be used in combination with particular interfaces. |
||
74 | * |
||
75 | * @var array(string => array(string => string)) |
||
76 | */ |
||
77 | protected $unsupportedMethods = array( |
||
78 | 'Serializable' => array( |
||
79 | '__sleep' => 'http://php.net/serializable', |
||
80 | '__wakeup' => 'http://php.net/serializable', |
||
81 | ), |
||
82 | ); |
||
83 | |||
84 | /** |
||
85 | * Returns an array of tokens this test wants to listen for. |
||
86 | * |
||
87 | * @return array |
||
88 | */ |
||
89 | public function register() |
||
98 | |||
99 | |||
100 | /** |
||
101 | * Processes this test, when one of its tokens is encountered. |
||
102 | * |
||
103 | * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
||
104 | * @param int $stackPtr The position of the current token in |
||
105 | * the stack passed in $tokens. |
||
106 | * |
||
107 | * @return void |
||
108 | */ |
||
109 | public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
||
161 | |||
162 | |||
163 | /** |
||
164 | * Get the relevant sub-array for a specific item from a multi-dimensional array. |
||
165 | * |
||
166 | * @param array $itemInfo Base information about the item. |
||
167 | * |
||
168 | * @return array Version and other information about the item. |
||
169 | */ |
||
170 | public function getItemArray(array $itemInfo) |
||
174 | |||
175 | |||
176 | /** |
||
177 | * Get the error message template for this sniff. |
||
178 | * |
||
179 | * @return string |
||
180 | */ |
||
181 | protected function getErrorMsgTemplate() |
||
185 | |||
186 | |||
187 | }//end class |
||
188 |
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.