Conditions | 3 |
Paths | 3 |
Total Lines | 21 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
45 | public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
||
46 | { |
||
47 | if ($this->supportsBelow('5.5') !== true) { |
||
48 | return; |
||
49 | } |
||
50 | |||
51 | $find = array( |
||
52 | T_ARRAY => T_ARRAY, |
||
53 | T_OPEN_SHORT_ARRAY => T_OPEN_SHORT_ARRAY, |
||
54 | T_CLOSE_SHORT_ARRAY => T_CLOSE_SHORT_ARRAY, |
||
55 | ); |
||
56 | |||
57 | $hasArray = $phpcsFile->findNext($find, ($stackPtr + 1), null, false, null, true); |
||
58 | if ($hasArray !== false) { |
||
59 | $phpcsFile->addError( |
||
60 | 'Constant arrays using the "const" keyword are not allowed in PHP 5.5 or earlier', |
||
61 | $hasArray, |
||
62 | 'Found' |
||
63 | ); |
||
64 | } |
||
65 | } |
||
66 | } |
||
67 |
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.