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.
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.
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
21 $cfg = require __DIR__
. '/../vendor/mediawiki/mediawiki-phan-config/src/config.php';
23 $cfg['file_list'] = array_merge(
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' ],
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',
45 $cfg['autoload_internal_extension_signatures'] = [
46 'memcached' => '.phan/internal_stubs/memcached.phan_php',
47 'oci8' => '.phan/internal_stubs/oci8.phan_php',
48 'sqlsrv' => '.phan/internal_stubs/sqlsrv.phan_php',
49 'tideways' => '.phan/internal_stubs/tideways.phan_php',
52 $cfg['directory_list'] = [
62 $cfg['exclude_analysis_directory_list'] = [
65 // The referenced classes are not available in vendor, only when
66 // included from composer.
68 // Directly references classes that only exist in Translate extension
69 'maintenance/language/',
71 'includes/libs/jsminplus.php',
74 $cfg['suppress_issue_types'] = array_merge( $cfg['suppress_issue_types'], [
75 // approximate error count: 18
76 "PhanAccessMethodInternal",
77 // approximate error count: 17
78 "PhanCommentParamOnEmptyParamList",
79 // approximate error count: 29
80 "PhanCommentParamWithoutRealParam",
81 // approximate error count: 2
82 "PhanCompatibleNegativeStringOffset",
83 // approximate error count: 21
84 "PhanParamReqAfterOpt",
85 // approximate error count: 26
86 "PhanParamSignatureMismatch",
87 // approximate error count: 4
88 "PhanParamSignatureMismatchInternal",
89 // approximate error count: 127
91 // approximate error count: 2
92 "PhanTraitParentReference",
93 // approximate error count: 30
94 "PhanTypeArraySuspicious",
95 // approximate error count: 27
96 "PhanTypeArraySuspiciousNullable",
97 // approximate error count: 26
98 "PhanTypeComparisonFromArray",
99 // approximate error count: 63
100 "PhanTypeInvalidDimOffset",
101 // approximate error count: 7
102 "PhanTypeInvalidLeftOperandOfIntegerOp",
103 // approximate error count: 2
104 "PhanTypeInvalidRightOperandOfIntegerOp",
105 // approximate error count: 154
106 "PhanTypeMismatchArgument",
107 // approximate error count: 27
108 "PhanTypeMismatchArgumentInternal",
109 // approximate error count: 2
110 "PhanTypeMismatchDimEmpty",
111 // approximate error count: 27
112 "PhanTypeMismatchDimFetch",
113 // approximate error count: 10
114 "PhanTypeMismatchForeach",
115 // approximate error count: 77
116 "PhanTypeMismatchProperty",
117 // approximate error count: 84
118 "PhanTypeMismatchReturn",
119 // approximate error count: 12
120 "PhanTypeObjectUnsetDeclaredProperty",
121 // approximate error count: 9
122 "PhanTypeSuspiciousNonTraversableForeach",
123 // approximate error count: 3
124 "PhanTypeSuspiciousStringExpression",
125 // approximate error count: 22
126 "PhanUndeclaredConstant",
127 // approximate error count: 3
128 "PhanUndeclaredInvokeInCallable",
129 // approximate error count: 237
130 "PhanUndeclaredMethod",
131 // approximate error count: 846
132 "PhanUndeclaredProperty",
133 // approximate error count: 2
134 "PhanUndeclaredVariableAssignOp",
135 // approximate error count: 55
136 "PhanUndeclaredVariableDim",
139 $cfg['ignore_undeclared_variables_in_global_scope'] = true;
140 $cfg['globals_type_map']['IP'] = 'string';