1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of the mo4-coding-standard (phpcs standard) |
5
|
|
|
* |
6
|
|
|
* PHP version 5 |
7
|
|
|
* |
8
|
|
|
* @category PHP |
9
|
|
|
* @package PHP_CodeSniffer-MO4 |
10
|
|
|
* @author Xaver Loppenstedt <[email protected]> |
11
|
|
|
* @license http://spdx.org/licenses/MIT MIT License |
12
|
|
|
* @version GIT: master |
13
|
|
|
* @link https://github.com/Mayflower/mo4-coding-standard |
14
|
|
|
*/ |
15
|
|
|
|
16
|
|
|
namespace MO4\Tests\Arrays; |
17
|
|
|
|
18
|
|
|
use PHP_CodeSniffer\Exceptions\RuntimeException; |
19
|
|
|
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest; |
|
|
|
|
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Unit test class for @see ArrayDoubleArrowAlignmentSniff |
23
|
|
|
* |
24
|
|
|
* A sniff unit test checks a .inc file for expected violations of a single |
25
|
|
|
* coding standard. Expected errors and warnings are stored in this class. |
26
|
|
|
* |
27
|
|
|
* @category PHP |
28
|
|
|
* @package PHP_CodeSniffer-MO4 |
29
|
|
|
* @author Xaver Loppenstedt <[email protected]> |
30
|
|
|
* @copyright 2013-2017 Xaver Loppenstedt, some rights reserved. |
31
|
|
|
* @license http://spdx.org/licenses/MIT MIT License |
32
|
|
|
* @link https://github.com/Mayflower/mo4-coding-standard |
33
|
|
|
*/ |
34
|
|
|
class ArrayDoubleArrowAlignmentUnitTest extends AbstractSniffUnitTest |
35
|
|
|
{ |
36
|
|
|
|
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* Returns the lines where errors should occur. |
40
|
|
|
* |
41
|
|
|
* The key of the array should represent the line number and the value |
42
|
|
|
* should represent the number of errors that should occur on that line. |
43
|
|
|
* |
44
|
|
|
* @param string $testFile test file |
45
|
|
|
* |
46
|
|
|
* @return array<int, int> |
47
|
|
|
* @throws RuntimeException |
48
|
|
|
*/ |
49
|
|
|
protected function getErrorList($testFile='') |
50
|
|
|
{ |
51
|
|
|
switch ($testFile) { |
52
|
|
|
case 'ArrayDoubleArrowAlignmentUnitTest.pass.inc': |
53
|
|
|
return array(); |
54
|
|
|
case 'ArrayDoubleArrowAlignmentUnitTest.fail.inc': |
55
|
|
|
return array( |
56
|
|
|
5 => 1, |
57
|
|
|
10 => 1, |
58
|
|
|
17 => 2, |
59
|
|
|
18 => 2, |
60
|
|
|
22 => 1, |
61
|
|
|
28 => 1, |
62
|
|
|
38 => 1, |
63
|
|
|
43 => 1, |
64
|
|
|
45 => 1, |
65
|
|
|
49 => 1, |
66
|
|
|
51 => 1, |
67
|
|
|
58 => 1, |
68
|
|
|
59 => 1, |
69
|
|
|
61 => 1, |
70
|
|
|
67 => 1, |
71
|
|
|
70 => 1, |
72
|
|
|
71 => 1, |
73
|
|
|
73 => 1, |
74
|
|
|
82 => 1, |
75
|
|
|
83 => 1, |
76
|
|
|
85 => 1, |
77
|
|
|
93 => 1, |
78
|
|
|
94 => 1, |
79
|
|
|
97 => 1, |
80
|
|
|
105 => 1, |
81
|
|
|
130 => 1, |
82
|
|
|
132 => 1, |
83
|
|
|
134 => 1, |
84
|
|
|
136 => 2, |
85
|
|
|
); |
86
|
|
|
}//end switch |
87
|
|
|
|
88
|
|
|
throw new RuntimeException("Testfile {$testFile} in ".__DIR__." is not handled by ".__CLASS__); |
89
|
|
|
|
90
|
|
|
}//end getErrorList() |
91
|
|
|
|
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* Returns the lines where warnings should occur. |
95
|
|
|
* |
96
|
|
|
* The key of the array should represent the line number and the value |
97
|
|
|
* should represent the number of warnings that should occur on that line. |
98
|
|
|
* |
99
|
|
|
* @return array<int, int> |
100
|
|
|
*/ |
101
|
|
|
protected function getWarningList() |
102
|
|
|
{ |
103
|
|
|
return array(); |
104
|
|
|
|
105
|
|
|
}//end getWarningList() |
106
|
|
|
|
107
|
|
|
|
108
|
|
|
}//end class |
109
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths