Merge "Fix sessionfailure i18n message during authentication"
[lhc/web/wiklou.git] / tests / phan / config.php
1 <?php
2
3 // If xdebug is enabled, we need to increase the nesting level for phan
4 ini_set( 'xdebug.max_nesting_level', 1000 );
5
6 /**
7 * This configuration will be read and overlayed on top of the
8 * default configuration. Command line arguments will be applied
9 * after this file is read.
10 *
11 * @see src/Phan/Config.php
12 * See Config for all configurable options.
13 *
14 * A Note About Paths
15 * ==================
16 *
17 * Files referenced from this file should be defined as
18 *
19 * ```
20 * Config::projectPath('relative_path/to/file')
21 * ```
22 *
23 * where the relative path is relative to the root of the
24 * project which is defined as either the working directory
25 * of the phan executable or a path passed in via the CLI
26 * '-d' flag.
27 */
28 return [
29 /**
30 * A list of individual files to include in analysis
31 * with a path relative to the root directory of the
32 * project. directory_list won't find .inc files so
33 * we augment it here.
34 */
35 'file_list' => array_merge(
36 function_exists( 'register_postsend_function' ) ? [] : [ 'tests/phan/stubs/hhvm.php' ],
37 function_exists( 'wikidiff2_do_diff' ) ? [] : [ 'tests/phan/stubs/wikidiff.php' ],
38 function_exists( 'tideways_enable' ) ? [] : [ 'tests/phan/stubs/tideways.php' ],
39 class_exists( PEAR::class ) ? [] : [ 'tests/phan/stubs/mail.php' ],
40 class_exists( Memcached::class ) ? [] : [ 'tests/phan/stubs/memcached.php' ],
41 [
42 'maintenance/7zip.inc',
43 'maintenance/backup.inc',
44 'maintenance/cleanupTable.inc',
45 'maintenance/CodeCleanerGlobalsPass.inc',
46 'maintenance/commandLine.inc',
47 'maintenance/importImages.inc',
48 'maintenance/sqlite.inc',
49 'maintenance/userDupes.inc',
50 'maintenance/userOptions.inc',
51 'maintenance/language/checkLanguage.inc',
52 'maintenance/language/languages.inc',
53 ]
54 ),
55
56 /**
57 * A list of directories that should be parsed for class and
58 * method information. After excluding the directories
59 * defined in exclude_analysis_directory_list, the remaining
60 * files will be statically analyzed for errors.
61 *
62 * Thus, both first-party and third-party code being used by
63 * your application should be included in this list.
64 */
65 'directory_list' => [
66 'includes/',
67 'languages/',
68 'maintenance/',
69 'mw-config/',
70 'resources/',
71 'skins/',
72 'vendor/',
73 ],
74
75 /**
76 * A file list that defines files that will be excluded
77 * from parsing and analysis and will not be read at all.
78 *
79 * This is useful for excluding hopelessly unanalyzable
80 * files that can't be removed for whatever reason.
81 */
82 'exclude_file_list' => [],
83
84 /**
85 * A list of directories holding code that we want
86 * to parse, but not analyze. Also works for individual
87 * files.
88 */
89 "exclude_analysis_directory_list" => [
90 'vendor/',
91 'tests/phan/stubs/',
92 // The referenced classes are not available in vendor, only when
93 // included from composer.
94 'includes/composer/',
95 // Directly references classes that only exist in Translate extension
96 'maintenance/language/',
97 // External class
98 'includes/libs/jsminplus.php',
99 // separate repositories
100 'skins/',
101 ],
102
103 /**
104 * Backwards Compatibility Checking. This is slow
105 * and expensive, but you should consider running
106 * it before upgrading your version of PHP to a
107 * new version that has backward compatibility
108 * breaks.
109 */
110 'backward_compatibility_checks' => false,
111
112 /**
113 * A set of fully qualified class-names for which
114 * a call to parent::__construct() is required
115 */
116 'parent_constructor_required' => [
117 ],
118
119 /**
120 * Run a quick version of checks that takes less
121 * time at the cost of not running as thorough
122 * an analysis. You should consider setting this
123 * to true only when you wish you had more issues
124 * to fix in your code base.
125 *
126 * In quick-mode the scanner doesn't rescan a function
127 * or a method's code block every time a call is seen.
128 * This means that the problem here won't be detected:
129 *
130 * ```php
131 * <?php
132 * function test($arg):int {
133 * return $arg;
134 * }
135 * test("abc");
136 * ```
137 *
138 * This would normally generate:
139 *
140 * ```sh
141 * test.php:3 TypeError return string but `test()` is declared to return int
142 * ```
143 *
144 * The initial scan of the function's code block has no
145 * type information for `$arg`. It isn't until we see
146 * the call and rescan test()'s code block that we can
147 * detect that it is actually returning the passed in
148 * `string` instead of an `int` as declared.
149 */
150 'quick_mode' => false,
151
152 /**
153 * By default, Phan will not analyze all node types
154 * in order to save time. If this config is set to true,
155 * Phan will dig deeper into the AST tree and do an
156 * analysis on all nodes, possibly finding more issues.
157 *
158 * See \Phan\Analysis::shouldVisit for the set of skipped
159 * nodes.
160 */
161 'should_visit_all_nodes' => true,
162
163 /**
164 * If enabled, check all methods that override a
165 * parent method to make sure its signature is
166 * compatible with the parent's. This check
167 * can add quite a bit of time to the analysis.
168 */
169 'analyze_signature_compatibility' => true,
170
171 // Emit all issues. They are then suppressed via
172 // suppress_issue_types, rather than a minimum
173 // severity.
174 "minimum_severity" => 0,
175
176 /**
177 * If true, missing properties will be created when
178 * they are first seen. If false, we'll report an
179 * error message if there is an attempt to write
180 * to a class property that wasn't explicitly
181 * defined.
182 */
183 'allow_missing_properties' => false,
184
185 /**
186 * Allow null to be cast as any type and for any
187 * type to be cast to null. Setting this to false
188 * will cut down on false positives.
189 */
190 'null_casts_as_any_type' => true,
191
192 /**
193 * If enabled, scalars (int, float, bool, string, null)
194 * are treated as if they can cast to each other.
195 *
196 * MediaWiki is pretty lax and uses many scalar
197 * types interchangably.
198 */
199 'scalar_implicit_cast' => true,
200
201 /**
202 * If true, seemingly undeclared variables in the global
203 * scope will be ignored. This is useful for projects
204 * with complicated cross-file globals that you have no
205 * hope of fixing.
206 */
207 'ignore_undeclared_variables_in_global_scope' => true,
208
209 /**
210 * Set to true in order to attempt to detect dead
211 * (unreferenced) code. Keep in mind that the
212 * results will only be a guess given that classes,
213 * properties, constants and methods can be referenced
214 * as variables (like `$class->$property` or
215 * `$class->$method()`) in ways that we're unable
216 * to make sense of.
217 */
218 'dead_code_detection' => false,
219
220 /**
221 * If true, the dead code detection rig will
222 * prefer false negatives (not report dead code) to
223 * false positives (report dead code that is not
224 * actually dead) which is to say that the graph of
225 * references will create too many edges rather than
226 * too few edges when guesses have to be made about
227 * what references what.
228 */
229 'dead_code_detection_prefer_false_negative' => true,
230
231 /**
232 * If disabled, Phan will not read docblock type
233 * annotation comments (such as for @return, @param,
234 * @var, @suppress, @deprecated) and only rely on
235 * types expressed in code.
236 */
237 'read_type_annotations' => true,
238
239 /**
240 * If a file path is given, the code base will be
241 * read from and written to the given location in
242 * order to attempt to save some work from being
243 * done. Only changed files will get analyzed if
244 * the file is read
245 */
246 'stored_state_file_path' => null,
247
248 /**
249 * Set to true in order to ignore issue suppression.
250 * This is useful for testing the state of your code, but
251 * unlikely to be useful outside of that.
252 */
253 'disable_suppression' => false,
254
255 /**
256 * If set to true, we'll dump the AST instead of
257 * analyzing files
258 */
259 'dump_ast' => false,
260
261 /**
262 * If set to a string, we'll dump the fully qualified lowercase
263 * function and method signatures instead of analyzing files.
264 */
265 'dump_signatures_file' => null,
266
267 /**
268 * If true (and if stored_state_file_path is set) we'll
269 * look at the list of files passed in and expand the list
270 * to include files that depend on the given files
271 */
272 'expand_file_list' => false,
273
274 // Include a progress bar in the output
275 'progress_bar' => false,
276
277 /**
278 * The probability of actually emitting any progress
279 * bar update. Setting this to something very low
280 * is good for reducing network IO and filling up
281 * your terminal's buffer when running phan on a
282 * remote host.
283 */
284 'progress_bar_sample_rate' => 0.005,
285
286 /**
287 * The number of processes to fork off during the analysis
288 * phase.
289 */
290 'processes' => 1,
291
292 /**
293 * Add any issue types (such as 'PhanUndeclaredMethod')
294 * to this black-list to inhibit them from being reported.
295 */
296 'suppress_issue_types' => [
297 // approximate error count: 29
298 "PhanCommentParamOnEmptyParamList",
299 // approximate error count: 33
300 "PhanCommentParamWithoutRealParam",
301 // approximate error count: 8
302 "PhanDeprecatedClass",
303 // approximate error count: 415
304 "PhanDeprecatedFunction",
305 // approximate error count: 25
306 "PhanDeprecatedProperty",
307 // approximate error count: 17
308 "PhanNonClassMethodCall",
309 // approximate error count: 11
310 "PhanParamReqAfterOpt",
311 // approximate error count: 888
312 "PhanParamSignatureMismatch",
313 // approximate error count: 7
314 "PhanParamSignatureMismatchInternal",
315 // approximate error count: 1
316 "PhanParamSignatureRealMismatchTooFewParameters",
317 // approximate error count: 125
318 "PhanParamTooMany",
319 // approximate error count: 1
320 "PhanParamTooManyCallable",
321 // approximate error count: 3
322 "PhanParamTooManyInternal",
323 // approximate error count: 1
324 "PhanRedefineFunctionInternal",
325 // approximate error count: 2
326 "PhanTraitParentReference",
327 // approximate error count: 3
328 "PhanTypeComparisonFromArray",
329 // approximate error count: 2
330 "PhanTypeComparisonToArray",
331 // approximate error count: 3
332 "PhanTypeInvalidRightOperand",
333 // approximate error count: 1
334 "PhanTypeMagicVoidWithReturn",
335 // approximate error count: 218
336 "PhanTypeMismatchArgument",
337 // approximate error count: 13
338 "PhanTypeMismatchArgumentInternal",
339 // approximate error count: 6
340 "PhanTypeMismatchDeclaredParam",
341 // approximate error count: 111
342 "PhanTypeMismatchDeclaredParamNullable",
343 // approximate error count: 1
344 "PhanTypeMismatchDefault",
345 // approximate error count: 5
346 "PhanTypeMismatchDimAssignment",
347 // approximate error count: 2
348 "PhanTypeMismatchDimEmpty",
349 // approximate error count: 1
350 "PhanTypeMismatchDimFetch",
351 // approximate error count: 14
352 "PhanTypeMismatchForeach",
353 // approximate error count: 56
354 "PhanTypeMismatchProperty",
355 // approximate error count: 74
356 "PhanTypeMismatchReturn",
357 // approximate error count: 11
358 "PhanTypeMissingReturn",
359 // approximate error count: 5
360 "PhanTypeNonVarPassByRef",
361 // approximate error count: 1
362 "PhanUndeclaredClassInCallable",
363 // approximate error count: 32
364 "PhanUndeclaredConstant",
365 // approximate error count: 233
366 "PhanUndeclaredMethod",
367 // approximate error count: 1224
368 "PhanUndeclaredProperty",
369 // approximate error count: 3
370 "PhanUndeclaredStaticMethod",
371 // approximate error count: 11
372 "PhanUndeclaredTypeReturnType",
373 // approximate error count: 27
374 "PhanUndeclaredVariable",
375 // approximate error count: 58
376 "PhanUndeclaredVariableDim",
377 ],
378
379 /**
380 * If empty, no filter against issues types will be applied.
381 * If this white-list is non-empty, only issues within the list
382 * will be emitted by Phan.
383 */
384 'whitelist_issue_types' => [
385 // 'PhanAccessMethodPrivate',
386 // 'PhanAccessMethodProtected',
387 // 'PhanAccessNonStaticToStatic',
388 // 'PhanAccessPropertyPrivate',
389 // 'PhanAccessPropertyProtected',
390 // 'PhanAccessSignatureMismatch',
391 // 'PhanAccessSignatureMismatchInternal',
392 // 'PhanAccessStaticToNonStatic',
393 // 'PhanCompatibleExpressionPHP7',
394 // 'PhanCompatiblePHP7',
395 // 'PhanContextNotObject',
396 // 'PhanDeprecatedClass',
397 // 'PhanDeprecatedFunction',
398 // 'PhanDeprecatedProperty',
399 // 'PhanEmptyFile',
400 // 'PhanNonClassMethodCall',
401 // 'PhanNoopArray',
402 // 'PhanNoopClosure',
403 // 'PhanNoopConstant',
404 // 'PhanNoopProperty',
405 // 'PhanNoopVariable',
406 // 'PhanParamRedefined',
407 // 'PhanParamReqAfterOpt',
408 // 'PhanParamSignatureMismatch',
409 // 'PhanParamSignatureMismatchInternal',
410 // 'PhanParamSpecial1',
411 // 'PhanParamSpecial2',
412 // 'PhanParamSpecial3',
413 // 'PhanParamSpecial4',
414 // 'PhanParamTooFew',
415 // 'PhanParamTooFewInternal',
416 // 'PhanParamTooMany',
417 // 'PhanParamTooManyInternal',
418 // 'PhanParamTypeMismatch',
419 // 'PhanParentlessClass',
420 // 'PhanRedefineClass',
421 // 'PhanRedefineClassInternal',
422 // 'PhanRedefineFunction',
423 // 'PhanRedefineFunctionInternal',
424 // 'PhanStaticCallToNonStatic',
425 // 'PhanSyntaxError',
426 // 'PhanTraitParentReference',
427 // 'PhanTypeArrayOperator',
428 // 'PhanTypeArraySuspicious',
429 // 'PhanTypeComparisonFromArray',
430 // 'PhanTypeComparisonToArray',
431 // 'PhanTypeConversionFromArray',
432 // 'PhanTypeInstantiateAbstract',
433 // 'PhanTypeInstantiateInterface',
434 // 'PhanTypeInvalidLeftOperand',
435 // 'PhanTypeInvalidRightOperand',
436 // 'PhanTypeMismatchArgument',
437 // 'PhanTypeMismatchArgumentInternal',
438 // 'PhanTypeMismatchDefault',
439 // 'PhanTypeMismatchForeach',
440 // 'PhanTypeMismatchProperty',
441 // 'PhanTypeMismatchReturn',
442 // 'PhanTypeMissingReturn',
443 // 'PhanTypeNonVarPassByRef',
444 // 'PhanTypeParentConstructorCalled',
445 // 'PhanTypeVoidAssignment',
446 // 'PhanUnanalyzable',
447 // 'PhanUndeclaredClass',
448 // 'PhanUndeclaredClassCatch',
449 // 'PhanUndeclaredClassConstant',
450 // 'PhanUndeclaredClassInstanceof',
451 // 'PhanUndeclaredClassMethod',
452 // 'PhanUndeclaredClassReference',
453 // 'PhanUndeclaredConstant',
454 // 'PhanUndeclaredExtendedClass',
455 // 'PhanUndeclaredFunction',
456 // 'PhanUndeclaredInterface',
457 // 'PhanUndeclaredMethod',
458 // 'PhanUndeclaredProperty',
459 // 'PhanUndeclaredStaticMethod',
460 // 'PhanUndeclaredStaticProperty',
461 // 'PhanUndeclaredTrait',
462 // 'PhanUndeclaredTypeParameter',
463 // 'PhanUndeclaredTypeProperty',
464 // 'PhanUndeclaredVariable',
465 // 'PhanUnreferencedClass',
466 // 'PhanUnreferencedConstant',
467 // 'PhanUnreferencedMethod',
468 // 'PhanUnreferencedProperty',
469 // 'PhanVariableUseClause',
470 ],
471
472 /**
473 * Override to hardcode existence and types of (non-builtin) globals in the global scope.
474 * Class names must be prefixed with '\\'.
475 * (E.g. ['_FOO' => '\\FooClass', 'page' => '\\PageClass', 'userId' => 'int'])
476 */
477 'globals_type_map' => [
478 'IP' => 'string',
479 ],
480
481 // Emit issue messages with markdown formatting
482 'markdown_issue_messages' => false,
483
484 /**
485 * Enable or disable support for generic templated
486 * class types.
487 */
488 'generic_types_enabled' => true,
489
490 // A list of plugin files to execute
491 'plugins' => [
492 ],
493 ];