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