-
-
Notifications
You must be signed in to change notification settings - Fork 100
Expand file tree
/
Copy pathFunctionCommentUnitTest.php
More file actions
210 lines (199 loc) · 6.09 KB
/
FunctionCommentUnitTest.php
File metadata and controls
210 lines (199 loc) · 6.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
<?php
/**
* Unit test class for the FunctionComment sniff.
*
* @author Greg Sherwood <gsherwood@squiz.net>
* @copyright 2006-2023 Squiz Pty Ltd (ABN 77 084 670 600)
* @copyright 2023 PHPCSStandards and contributors
* @license https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/HEAD/licence.txt BSD Licence
*/
namespace PHP_CodeSniffer\Standards\Squiz\Tests\Commenting;
use PHP_CodeSniffer\Tests\Standards\AbstractSniffTestCase;
/**
* Unit test class for the FunctionComment sniff.
*
* @covers \PHP_CodeSniffer\Standards\Squiz\Sniffs\Commenting\FunctionCommentSniff
*/
final class FunctionCommentUnitTest extends AbstractSniffTestCase
{
/**
* Returns the lines where errors should occur.
*
* The key of the array should represent the line number and the value
* should represent the number of errors that should occur on that line.
*
* @param string $testFile The name of the test file being tested.
*
* @return array<int, int>
*/
public function getErrorList($testFile = '')
{
switch ($testFile) {
case 'FunctionCommentUnitTest.1.inc':
$errors = [
5 => 1,
10 => 3,
12 => 2,
13 => 2,
14 => 1,
15 => 1,
17 => 3,
28 => 1,
43 => 1,
76 => 1,
87 => 1,
103 => 1,
109 => 1,
112 => 1,
122 => 1,
123 => 3,
124 => 2,
125 => 1,
126 => 1,
128 => 1,
137 => 4,
138 => 4,
139 => 4,
143 => 3,
155 => 1,
159 => 1,
161 => 2,
166 => 1,
173 => 1,
183 => 1,
190 => 2,
193 => 2,
196 => 1,
199 => 2,
201 => 1,
210 => 1,
211 => 1,
222 => 1,
223 => 1,
224 => 1,
225 => 1,
226 => 1,
227 => 1,
230 => 2,
232 => 7,
246 => 1,
248 => 4,
261 => 1,
263 => 1,
276 => 1,
277 => 1,
278 => 1,
279 => 1,
280 => 1,
281 => 1,
284 => 1,
286 => 7,
294 => 1,
302 => 1,
312 => 1,
358 => 1,
359 => 2,
363 => 3,
372 => 1,
373 => 1,
377 => 1,
387 => 1,
407 => 1,
441 => 1,
500 => 1,
526 => 1,
548 => 1,
575 => 2,
627 => 2,
641 => 1,
669 => 1,
688 => 1,
744 => 1,
748 => 1,
767 => 1,
789 => 1,
792 => 1,
794 => 1,
797 => 1,
828 => 1,
840 => 1,
852 => 1,
864 => 1,
886 => 1,
888 => 1,
890 => 1,
978 => 1,
997 => 1,
1002 => 1,
1004 => 2,
1006 => 1,
1029 => 1,
1053 => 1,
1058 => 2,
1069 => 1,
1070 => 1,
1071 => 1,
1075 => 6,
1080 => 2,
1083 => 1,
1084 => 1,
1085 => 1,
1089 => 3,
1093 => 4,
1100 => 1,
1101 => 1,
1102 => 1,
1103 => 1,
1107 => 8,
1123 => 1,
1124 => 1,
1125 => 1,
1129 => 3,
1138 => 1,
1139 => 1,
1144 => 1,
1145 => 1,
1151 => 1,
1154 => 1,
1160 => 1,
1174 => 1,
1183 => 1,
1192 => 1,
];
// Mixed type hints only work from PHP 8.0 onwards.
if (PHP_VERSION_ID >= 80000) {
$errors[265] = 1;
$errors[459] = 1;
$errors[893] = 3;
} else {
$errors[1023] = 1;
}
return $errors;
case 'FunctionCommentUnitTest.2.inc':
return [
8 => 1,
];
case 'FunctionCommentUnitTest.3.inc':
return [
8 => 1,
10 => 1,
25 => 1,
27 => 1,
];
default:
return [];
}
}
/**
* Returns the lines where warnings should occur.
*
* The key of the array should represent the line number and the value
* should represent the number of warnings that should occur on that line.
*
* @return array<int, int>
*/
public function getWarningList()
{
return [];
}
}