1 | <?php |
||
17 | class PHPCompatibility_Sniffs_PHP_RequiredOptionalFunctionParametersSniff extends PHPCompatibility_Sniff |
||
|
|||
18 | { |
||
19 | |||
20 | /** |
||
21 | * A list of function parameters, which were required in older versions and became optional later on. |
||
22 | * |
||
23 | * The array lists : version number with true (required) and false (optional). |
||
24 | * |
||
25 | * The index is the location of the parameter in the parameter list, starting at 0 ! |
||
26 | * If's sufficient to list the last version in which the parameter was still required. |
||
27 | * |
||
28 | * @var array |
||
29 | */ |
||
30 | protected $functionParameters = array( |
||
31 | 'preg_match_all' => array( |
||
32 | 2 => array( |
||
33 | 'name' => 'matches', |
||
34 | '5.3' => true, |
||
35 | '5.4' => false, |
||
36 | ), |
||
37 | ), |
||
38 | 'stream_socket_enable_crypto' => array( |
||
39 | 2 => array( |
||
40 | 'name' => 'crypto_type', |
||
41 | '5.5' => true, |
||
42 | '5.6' => false, |
||
43 | ), |
||
44 | ), |
||
45 | ); |
||
46 | |||
47 | |||
48 | /** |
||
49 | * Returns an array of tokens this test wants to listen for. |
||
50 | * |
||
51 | * @return array |
||
52 | */ |
||
53 | public function register() |
||
57 | |||
58 | /** |
||
59 | * Processes this test, when one of its tokens is encountered. |
||
60 | * |
||
61 | * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
||
62 | * @param int $stackPtr The position of the current token in |
||
63 | * the stack passed in $tokens. |
||
64 | * |
||
65 | * @return void |
||
66 | */ |
||
67 | public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
||
125 | |||
126 | }//end class |
||
127 |
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.