1 | <?php |
||
19 | class PHPCompatibility_Sniffs_PHP_RemovedGlobalVariablesSniff extends PHPCompatibility_AbstractRemovedFeatureSniff |
||
|
|||
20 | { |
||
21 | |||
22 | /** |
||
23 | * A list of removed global variables with their alternative, if any. |
||
24 | * |
||
25 | * The array lists : version number with false (deprecated) and true (removed). |
||
26 | * If's sufficient to list the first version where the variable was deprecated/removed. |
||
27 | * |
||
28 | * @var array(string|null) |
||
29 | */ |
||
30 | protected $removedGlobalVariables = array( |
||
31 | 'HTTP_POST_VARS' => array( |
||
32 | '5.3' => false, |
||
33 | '5.4' => true, |
||
34 | 'alternative' => '$_POST', |
||
35 | ), |
||
36 | 'HTTP_GET_VARS' => array( |
||
37 | '5.3' => false, |
||
38 | '5.4' => true, |
||
39 | 'alternative' => '$_GET', |
||
40 | ), |
||
41 | 'HTTP_ENV_VARS' => array( |
||
42 | '5.3' => false, |
||
43 | '5.4' => true, |
||
44 | 'alternative' => '$_ENV', |
||
45 | ), |
||
46 | 'HTTP_SERVER_VARS' => array( |
||
47 | '5.3' => false, |
||
48 | '5.4' => true, |
||
49 | 'alternative' => '$_SERVER', |
||
50 | ), |
||
51 | 'HTTP_COOKIE_VARS' => array( |
||
52 | '5.3' => false, |
||
53 | '5.4' => true, |
||
54 | 'alternative' => '$_COOKIE', |
||
55 | ), |
||
56 | 'HTTP_SESSION_VARS' => array( |
||
57 | '5.3' => false, |
||
58 | '5.4' => true, |
||
59 | 'alternative' => '$_SESSION', |
||
60 | ), |
||
61 | 'HTTP_POST_FILES' => array( |
||
62 | '5.3' => false, |
||
63 | '5.4' => true, |
||
64 | 'alternative' => '$_FILES', |
||
65 | ), |
||
66 | |||
67 | 'HTTP_RAW_POST_DATA' => array( |
||
68 | '5.6' => false, |
||
69 | '7.0' => true, |
||
70 | 'alternative' => 'php://input', |
||
71 | ), |
||
72 | ); |
||
73 | |||
74 | /** |
||
75 | * Returns an array of tokens this test wants to listen for. |
||
76 | * |
||
77 | * @return array |
||
78 | */ |
||
79 | public function register() |
||
84 | |||
85 | /** |
||
86 | * Processes this test, when one of its tokens is encountered. |
||
87 | * |
||
88 | * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
||
89 | * @param int $stackPtr The position of the current token in the |
||
90 | * stack passed in $tokens. |
||
91 | * |
||
92 | * @return void |
||
93 | */ |
||
94 | public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
||
142 | |||
143 | |||
144 | /** |
||
145 | * Get the relevant sub-array for a specific item from a multi-dimensional array. |
||
146 | * |
||
147 | * @param array $itemInfo Base information about the item. |
||
148 | * |
||
149 | * @return array Version and other information about the item. |
||
150 | */ |
||
151 | public function getItemArray(array $itemInfo) |
||
155 | |||
156 | |||
157 | /** |
||
158 | * Get the error message template for this sniff. |
||
159 | * |
||
160 | * @return string |
||
161 | */ |
||
162 | protected function getErrorMsgTemplate() |
||
166 | |||
167 | |||
168 | }//end class |
||
169 |
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.