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
|
<?php
/**
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
* @file
*/
$cfg = require __DIR__ . '/../vendor/mediawiki/mediawiki-phan-config/src/config.php';
$cfg['file_list'] = array_merge(
$cfg['file_list'],
function_exists( 'register_postsend_function' ) ? [] : [ '.phan/stubs/hhvm.php' ],
function_exists( 'wikidiff2_do_diff' ) ? [] : [ '.phan/stubs/wikidiff.php' ],
class_exists( PEAR::class ) ? [] : [ '.phan/stubs/mail.php' ],
defined( 'PASSWORD_ARGON2I' ) ? [] : [ '.phan/stubs/password.php' ],
// Per composer.json, PHPUnit 6 is used for PHP 7.0+, PHPUnit 4 otherwise.
// Load the interface for the version of PHPUnit that isn't installed.
// Phan only supports PHP 7.0+ (and not HHVM), so we only need to stub PHPUnit 4.
class_exists( PHPUnit_TextUI_Command::class ) ? [] : [ '.phan/stubs/phpunit4.php' ],
class_exists( ProfilerExcimer::class ) ? [] : [ '.phan/stubs/excimer.php' ],
[
'maintenance/cleanupTable.inc',
'maintenance/CodeCleanerGlobalsPass.inc',
'maintenance/commandLine.inc',
'maintenance/sqlite.inc',
'maintenance/userDupes.inc',
'maintenance/language/checkLanguage.inc',
'maintenance/language/languages.inc',
]
);
$cfg['autoload_internal_extension_signatures'] = [
'imagick' => '.phan/internal_stubs/imagick.phan_php',
'memcached' => '.phan/internal_stubs/memcached.phan_php',
'oci8' => '.phan/internal_stubs/oci8.phan_php',
'pcntl' => '.phan/internal_stubs/pcntl.phan_php',
'redis' => '.phan/internal_stubs/redis.phan_php',
'sockets' => '.phan/internal_stubs/sockets.phan_php',
'sqlsrv' => '.phan/internal_stubs/sqlsrv.phan_php',
'tideways' => '.phan/internal_stubs/tideways.phan_php',
];
$cfg['directory_list'] = [
'includes/',
'languages/',
'maintenance/',
'mw-config/',
'resources/',
'vendor/',
'.phan/stubs/',
];
$cfg['exclude_analysis_directory_list'] = [
'vendor/',
'.phan/stubs/',
// The referenced classes are not available in vendor, only when
// included from composer.
'includes/composer/',
// Directly references classes that only exist in Translate extension
'maintenance/language/',
// External class
'includes/libs/jsminplus.php',
];
$cfg['suppress_issue_types'] = array_merge( $cfg['suppress_issue_types'], [
// approximate error count: 18
"PhanAccessMethodInternal",
// approximate error count: 17
"PhanCommentParamOnEmptyParamList",
// approximate error count: 29
"PhanCommentParamWithoutRealParam",
// approximate error count: 21
"PhanParamReqAfterOpt",
// approximate error count: 26
"PhanParamSignatureMismatch",
// approximate error count: 127
"PhanParamTooMany",
// approximate error count: 30
"PhanTypeArraySuspicious",
// approximate error count: 27
"PhanTypeArraySuspiciousNullable",
// approximate error count: 26
"PhanTypeComparisonFromArray",
// approximate error count: 63
"PhanTypeInvalidDimOffset",
// approximate error count: 154
"PhanTypeMismatchArgument",
// approximate error count: 27
"PhanTypeMismatchArgumentInternal",
// approximate error count: 27
"PhanTypeMismatchDimFetch",
// approximate error count: 10
"PhanTypeMismatchForeach",
// approximate error count: 77
"PhanTypeMismatchProperty",
// approximate error count: 84
"PhanTypeMismatchReturn",
// approximate error count: 12
"PhanTypeObjectUnsetDeclaredProperty",
// approximate error count: 22
"PhanUndeclaredConstant",
// approximate error count: 237
"PhanUndeclaredMethod",
// approximate error count: 846
"PhanUndeclaredProperty",
// approximate error count: 55
"PhanUndeclaredVariableDim",
] );
$cfg['ignore_undeclared_variables_in_global_scope'] = true;
$cfg['globals_type_map'] = array_merge( $cfg['globals_type_map'], [
'IP' => 'string',
'wgGalleryOptions' => 'array',
'wgDummyLanguageCodes' => 'string[]',
] );
return $cfg;
|