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 | |||
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 | /** |
||
87 | * Processes this test, when one of its tokens is encountered. |
||
88 | * |
||
89 | * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
||
90 | * @param int $stackPtr The position of the current token in the |
||
91 | * stack passed in $tokens. |
||
92 | * |
||
93 | * @return void |
||
94 | */ |
||
95 | public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
||
163 | |||
164 | |||
165 | }//end class |
||
166 |
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.