|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* PHPCompatibility_ComplexVersionInterface. |
|
4
|
|
|
* |
|
5
|
|
|
* @category PHP |
|
6
|
|
|
* @package PHPCompatibility |
|
7
|
|
|
* @author Juliette Reinders Folmer <[email protected]> |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
/** |
|
11
|
|
|
* PHPCompatibility_ComplexVersionInterface. |
|
12
|
|
|
* |
|
13
|
|
|
* Interface to be implemented by sniffs using a multi-dimensional array of |
|
14
|
|
|
* PHP features (functions, classes etc) being sniffed for with version |
|
15
|
|
|
* information in sub-arrays. |
|
16
|
|
|
* |
|
17
|
|
|
* @category PHP |
|
18
|
|
|
* @package PHPCompatibility |
|
19
|
|
|
* @author Juliette Reinders Folmer <[email protected]> |
|
20
|
|
|
*/ |
|
21
|
|
|
interface PHPCompatibility_ComplexVersionInterface |
|
|
|
|
|
|
22
|
|
|
{ |
|
23
|
|
|
|
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* Handle the retrieval of relevant information and - if necessary - throwing of an |
|
27
|
|
|
* error/warning for an item. |
|
28
|
|
|
* |
|
29
|
|
|
* @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
30
|
|
|
* @param int $stackPtr The position of the relevant token in |
|
31
|
|
|
* the stack. |
|
32
|
|
|
* @param array $itemInfo Base information about the item. |
|
33
|
|
|
* |
|
34
|
|
|
* @return void |
|
35
|
|
|
*/ |
|
36
|
|
|
public function handleFeature(PHP_CodeSniffer_File $phpcsFile, $stackPtr, array $itemInfo); |
|
37
|
|
|
|
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* Get the relevant sub-array for a specific item from a multi-dimensional array. |
|
41
|
|
|
* |
|
42
|
|
|
* @param array $itemInfo Base information about the item. |
|
43
|
|
|
* |
|
44
|
|
|
* @return array Version and other information about the item. |
|
45
|
|
|
*/ |
|
46
|
|
|
public function getItemArray(array $itemInfo); |
|
47
|
|
|
|
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* Retrieve the relevant detail (version) information for use in an error message. |
|
51
|
|
|
* |
|
52
|
|
|
* @param array $itemArray Version and other information about the item. |
|
53
|
|
|
* @param array $itemInfo Base information about the item. |
|
54
|
|
|
* |
|
55
|
|
|
* @return array |
|
56
|
|
|
*/ |
|
57
|
|
|
public function getErrorInfo(array $itemArray, array $itemInfo); |
|
58
|
|
|
|
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* Generates the error or warning for this item. |
|
62
|
|
|
* |
|
63
|
|
|
* @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
64
|
|
|
* @param int $stackPtr The position of the relevant token in |
|
65
|
|
|
* the stack. |
|
66
|
|
|
* @param array $itemInfo Base information about the item. |
|
67
|
|
|
* @param array $errorInfo Array with detail (version) information |
|
68
|
|
|
* relevant to the item. |
|
69
|
|
|
* |
|
70
|
|
|
* @return void |
|
71
|
|
|
*/ |
|
72
|
|
|
public function addError(PHP_CodeSniffer_File $phpcsFile, $stackPtr, array $itemInfo, array $errorInfo); |
|
73
|
|
|
|
|
74
|
|
|
|
|
75
|
|
|
}//end interface |
|
76
|
|
|
|
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.