1 | <?php |
||
23 | class PHPCompatibility_Sniffs_PHP_NonStaticMagicMethodsSniff extends PHPCompatibility_Sniff |
||
|
|||
24 | { |
||
25 | |||
26 | /** |
||
27 | * A list of PHP magic methods and their visibility and static requirements. |
||
28 | * |
||
29 | * Method names in the array should be all *lowercase*. |
||
30 | * Visibility can be either 'public', 'protected' or 'private'. |
||
31 | * Static can be either 'true' - *must* be static, or 'false' - *must* be non-static. |
||
32 | * When a method does not have a specific requirement for either visibility or static, |
||
33 | * do *not* add the key. |
||
34 | * |
||
35 | * @var array(string) |
||
36 | */ |
||
37 | protected $magicMethods = array( |
||
38 | '__get' => array( |
||
39 | 'visibility' => 'public', |
||
40 | 'static' => false, |
||
41 | ), |
||
42 | '__set' => array( |
||
43 | 'visibility' => 'public', |
||
44 | 'static' => false, |
||
45 | ), |
||
46 | '__isset' => array( |
||
47 | 'visibility' => 'public', |
||
48 | 'static' => false, |
||
49 | ), |
||
50 | '__unset' => array( |
||
51 | 'visibility' => 'public', |
||
52 | 'static' => false, |
||
53 | ), |
||
54 | '__call' => array( |
||
55 | 'visibility' => 'public', |
||
56 | 'static' => false, |
||
57 | ), |
||
58 | '__callstatic' => array( |
||
59 | 'visibility' => 'public', |
||
60 | 'static' => true, |
||
61 | ), |
||
62 | '__sleep' => array( |
||
63 | 'visibility' => 'public', |
||
64 | ), |
||
65 | '__tostring' => array( |
||
66 | 'visibility' => 'public', |
||
67 | ), |
||
68 | '__set_state' => array( |
||
69 | 'static' => true, |
||
70 | ), |
||
71 | |||
72 | /* |
||
73 | * SoapClient specific magic methods. |
||
74 | * @link http://php.net/manual/en/class.soapclient.php |
||
75 | */ |
||
76 | '__dorequest' => array( |
||
77 | 'visibility' => 'public', |
||
78 | ), |
||
79 | '__getfunctions' => array( |
||
80 | 'visibility' => 'public', |
||
81 | ), |
||
82 | '__getlastrequest' => array( |
||
83 | 'visibility' => 'public', |
||
84 | ), |
||
85 | '__getlastrequestheaders' => array( |
||
86 | 'visibility' => 'public', |
||
87 | ), |
||
88 | '__getlastresponse' => array( |
||
89 | 'visibility' => 'public', |
||
90 | ), |
||
91 | '__getlastresponseheaders' => array( |
||
92 | 'visibility' => 'public', |
||
93 | ), |
||
94 | '__gettypes' => array( |
||
95 | 'visibility' => 'public', |
||
96 | ), |
||
97 | '__setcookie' => array( |
||
98 | 'visibility' => 'public', |
||
99 | ), |
||
100 | '__setlocation' => array( |
||
101 | 'visibility' => 'public', |
||
102 | ), |
||
103 | '__setsoapheaders' => array( |
||
104 | 'visibility' => 'public', |
||
105 | ), |
||
106 | '__soapcall' => array( |
||
107 | 'visibility' => 'public', |
||
108 | ), |
||
109 | ); |
||
110 | |||
111 | |||
112 | /** |
||
113 | * Returns an array of tokens this test wants to listen for. |
||
114 | * |
||
115 | * @return array |
||
116 | */ |
||
117 | public function register() |
||
122 | |||
123 | |||
124 | /** |
||
125 | * Processes this test, when one of its tokens is encountered. |
||
126 | * |
||
127 | * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
||
128 | * @param int $stackPtr The position of the current token in the |
||
129 | * stack passed in $tokens. |
||
130 | * |
||
131 | * @return void |
||
132 | */ |
||
133 | public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
||
201 | |||
202 | |||
203 | }//end class |
||
204 |
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.