Merge "Selenium: replace UserLoginPage with BlankPage where possible"
[lhc/web/wiklou.git] / .phan / config.php
1 <?php
2 /**
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * http://www.gnu.org/copyleft/gpl.html
17 *
18 * @file
19 */
20
21 $cfg = require __DIR__ . '/../vendor/mediawiki/mediawiki-phan-config/src/config.php';
22
23 $cfg['file_list'] = array_merge(
24 $cfg['file_list'],
25 function_exists( 'register_postsend_function' ) ? [] : [ '.phan/stubs/hhvm.php' ],
26 function_exists( 'wikidiff2_do_diff' ) ? [] : [ '.phan/stubs/wikidiff.php' ],
27 class_exists( PEAR::class ) ? [] : [ '.phan/stubs/mail.php' ],
28 defined( 'PASSWORD_ARGON2I' ) ? [] : [ '.phan/stubs/password.php' ],
29 // Per composer.json, PHPUnit 6 is used for PHP 7.0+, PHPUnit 4 otherwise.
30 // Load the interface for the version of PHPUnit that isn't installed.
31 // Phan only supports PHP 7.0+ (and not HHVM), so we only need to stub PHPUnit 4.
32 class_exists( PHPUnit_TextUI_Command::class ) ? [] : [ '.phan/stubs/phpunit4.php' ],
33 class_exists( ProfilerExcimer::class ) ? [] : [ '.phan/stubs/excimer.php' ],
34 [
35 'maintenance/cleanupTable.inc',
36 'maintenance/CodeCleanerGlobalsPass.inc',
37 'maintenance/commandLine.inc',
38 'maintenance/sqlite.inc',
39 'maintenance/userDupes.inc',
40 'maintenance/language/checkLanguage.inc',
41 'maintenance/language/languages.inc',
42 ]
43 );
44
45 $cfg['autoload_internal_extension_signatures'] = [
46 'imagick' => '.phan/internal_stubs/imagick.phan_php',
47 'memcached' => '.phan/internal_stubs/memcached.phan_php',
48 'oci8' => '.phan/internal_stubs/oci8.phan_php',
49 'pcntl' => '.phan/internal_stubs/pcntl.phan_php',
50 'redis' => '.phan/internal_stubs/redis.phan_php',
51 'sockets' => '.phan/internal_stubs/sockets.phan_php',
52 'sqlsrv' => '.phan/internal_stubs/sqlsrv.phan_php',
53 'tideways' => '.phan/internal_stubs/tideways.phan_php',
54 ];
55
56 $cfg['directory_list'] = [
57 'includes/',
58 'languages/',
59 'maintenance/',
60 'mw-config/',
61 'resources/',
62 'vendor/',
63 '.phan/stubs/',
64 ];
65
66 $cfg['exclude_analysis_directory_list'] = [
67 'vendor/',
68 '.phan/stubs/',
69 // The referenced classes are not available in vendor, only when
70 // included from composer.
71 'includes/composer/',
72 // Directly references classes that only exist in Translate extension
73 'maintenance/language/',
74 // External class
75 'includes/libs/jsminplus.php',
76 ];
77
78 $cfg['suppress_issue_types'] = array_merge( $cfg['suppress_issue_types'], [
79 // approximate error count: 18
80 "PhanAccessMethodInternal",
81 // approximate error count: 17
82 "PhanCommentParamOnEmptyParamList",
83 // approximate error count: 29
84 "PhanCommentParamWithoutRealParam",
85 // approximate error count: 2
86 "PhanCompatibleNegativeStringOffset",
87 // approximate error count: 21
88 "PhanParamReqAfterOpt",
89 // approximate error count: 26
90 "PhanParamSignatureMismatch",
91 // approximate error count: 4
92 "PhanParamSignatureMismatchInternal",
93 // approximate error count: 127
94 "PhanParamTooMany",
95 // approximate error count: 2
96 "PhanTraitParentReference",
97 // approximate error count: 30
98 "PhanTypeArraySuspicious",
99 // approximate error count: 27
100 "PhanTypeArraySuspiciousNullable",
101 // approximate error count: 26
102 "PhanTypeComparisonFromArray",
103 // approximate error count: 63
104 "PhanTypeInvalidDimOffset",
105 // approximate error count: 7
106 "PhanTypeInvalidLeftOperandOfIntegerOp",
107 // approximate error count: 2
108 "PhanTypeInvalidRightOperandOfIntegerOp",
109 // approximate error count: 154
110 "PhanTypeMismatchArgument",
111 // approximate error count: 27
112 "PhanTypeMismatchArgumentInternal",
113 // approximate error count: 2
114 "PhanTypeMismatchDimEmpty",
115 // approximate error count: 27
116 "PhanTypeMismatchDimFetch",
117 // approximate error count: 10
118 "PhanTypeMismatchForeach",
119 // approximate error count: 77
120 "PhanTypeMismatchProperty",
121 // approximate error count: 84
122 "PhanTypeMismatchReturn",
123 // approximate error count: 12
124 "PhanTypeObjectUnsetDeclaredProperty",
125 // approximate error count: 9
126 "PhanTypeSuspiciousNonTraversableForeach",
127 // approximate error count: 3
128 "PhanTypeSuspiciousStringExpression",
129 // approximate error count: 22
130 "PhanUndeclaredConstant",
131 // approximate error count: 3
132 "PhanUndeclaredInvokeInCallable",
133 // approximate error count: 237
134 "PhanUndeclaredMethod",
135 // approximate error count: 846
136 "PhanUndeclaredProperty",
137 // approximate error count: 2
138 "PhanUndeclaredVariableAssignOp",
139 // approximate error count: 55
140 "PhanUndeclaredVariableDim",
141 ] );
142
143 $cfg['ignore_undeclared_variables_in_global_scope'] = true;
144 $cfg['globals_type_map']['IP'] = 'string';
145
146 return $cfg;