1 | <?php |
||
17 | class PHPCompatibility_Sniffs_PHP_InternalInterfacesSniff extends PHPCompatibility_Sniff |
||
|
|||
18 | { |
||
19 | |||
20 | /** |
||
21 | * A list of PHP internal interfaces, not intended to be implemented by userland classes. |
||
22 | * |
||
23 | * The array lists : the error message to use. |
||
24 | * |
||
25 | * @var array(string => string) |
||
26 | */ |
||
27 | protected $internalInterfaces = array( |
||
28 | 'Traversable' => 'shouldn\'t be implemented directly, implement the Iterator or IteratorAggregate interface instead.', |
||
29 | 'DateTimeInterface' => 'is intended for type hints only and is not implementable.', |
||
30 | 'Throwable' => 'cannot be implemented directly, extend the Exception class instead.', |
||
31 | ); |
||
32 | |||
33 | |||
34 | /** |
||
35 | * Returns an array of tokens this test wants to listen for. |
||
36 | * |
||
37 | * @return array |
||
38 | */ |
||
39 | 13 | public function register() |
|
40 | { |
||
41 | // Handle case-insensitivity of interface names. |
||
42 | 13 | $this->internalInterfaces = $this->arrayKeysToLowercase($this->internalInterfaces); |
|
43 | |||
44 | 13 | $targets = array(T_CLASS); |
|
45 | |||
46 | 13 | if (defined('T_ANON_CLASS')) { |
|
47 | 13 | $targets[] = constant('T_ANON_CLASS'); |
|
48 | 13 | } |
|
49 | |||
50 | 13 | return $targets; |
|
51 | |||
52 | }//end register() |
||
53 | |||
54 | |||
55 | /** |
||
56 | * Processes this test, when one of its tokens is encountered. |
||
57 | * |
||
58 | * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
||
59 | * @param int $stackPtr The position of the current token in |
||
60 | * the stack passed in $tokens. |
||
61 | * |
||
62 | * @return void |
||
63 | */ |
||
64 | 1 | public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
|
87 | |||
88 | |||
89 | }//end class |
||
90 |
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.