Do not insert page titles into querycache.qc_value
[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 // This makes constants and globals known to Phan before processing all other files.
36 // You can check the parser order with --dump-parsed-file-list
37 'includes/Defines.php',
38 // @todo This isn't working yet, see globals_type_map below
39 // 'includes/DefaultSettings.php',
40 // 'includes/Setup.php',
41 ]
42 );
43
44 $cfg['exclude_file_list'] = array_merge(
45 $cfg['exclude_file_list'],
46 [
47 // This file has invalid PHP syntax
48 'vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Tests/Methods/MethodDeclarationUnitTest.inc',
49 ]
50 );
51
52 $cfg['analyzed_file_extensions'] = array_merge(
53 $cfg['analyzed_file_extensions'] ?? [ 'php' ],
54 [ 'inc' ]
55 );
56
57 $cfg['autoload_internal_extension_signatures'] = [
58 'dom' => '.phan/internal_stubs/dom.phan_php',
59 'imagick' => '.phan/internal_stubs/imagick.phan_php',
60 'intl' => '.phan/internal_stubs/intl.phan_php',
61 'memcached' => '.phan/internal_stubs/memcached.phan_php',
62 'oci8' => '.phan/internal_stubs/oci8.phan_php',
63 'pcntl' => '.phan/internal_stubs/pcntl.phan_php',
64 'pgsql' => '.phan/internal_stubs/pgsql.phan_php',
65 'redis' => '.phan/internal_stubs/redis.phan_php',
66 'sockets' => '.phan/internal_stubs/sockets.phan_php',
67 'sqlsrv' => '.phan/internal_stubs/sqlsrv.phan_php',
68 'tideways' => '.phan/internal_stubs/tideways.phan_php',
69 ];
70
71 $cfg['directory_list'] = [
72 'includes/',
73 'languages/',
74 'maintenance/',
75 'mw-config/',
76 'resources/',
77 'vendor/',
78 '.phan/stubs/',
79 ];
80
81 $cfg['exclude_analysis_directory_list'] = [
82 'vendor/',
83 '.phan/',
84 // The referenced classes are not available in vendor, only when
85 // included from composer.
86 'includes/composer/',
87 // Directly references classes that only exist in Translate extension
88 'maintenance/language/',
89 // External class
90 'includes/libs/jsminplus.php',
91 // External class
92 'includes/libs/objectcache/utils/MemcachedClient.php',
93 ];
94
95 // NOTE: If you're facing an issue which you cannot easily fix, DO NOT add it here. Suppress it
96 // either in-line with @phan-suppress-next-line and similar, at block-level (via @suppress), or at
97 // file-level (with @phan-file-suppress), so that it stays enabled for the rest of the codebase.
98 $cfg['suppress_issue_types'] = array_merge( $cfg['suppress_issue_types'], [
99 // approximate error count: 19
100 "PhanParamReqAfterOpt", // False positives with nullables (phan issue #3159). Use real nullables
101 //after dropping HHVM
102 // approximate error count: 110
103 "PhanParamTooMany", // False positives with variargs. Unsuppress after dropping HHVM
104 ] );
105
106 // This helps a lot in discovering bad code, but unfortunately it will always fail for
107 // hooks + pass by reference, see phan issue #2943.
108 // @todo Enable when the issue above is resolved and we update our config!
109 $cfg['redundant_condition_detection'] = false;
110
111 // Do not use aliases in core.
112 // Use the correct name, because we don't need backward compatibility
113 $cfg['enable_class_alias_support'] = false;
114
115 $cfg['ignore_undeclared_variables_in_global_scope'] = true;
116 // @todo It'd be great if we could just make phan read these from DefaultSettings, to avoid
117 // duplicating the types.
118 $cfg['globals_type_map'] = array_merge( $cfg['globals_type_map'], [
119 'IP' => 'string',
120 'wgGalleryOptions' => 'array',
121 'wgDummyLanguageCodes' => 'string[]',
122 'wgNamespaceProtection' => 'array<string,string|string[]>',
123 'wgNamespaceAliases' => 'array<string,int>',
124 'wgLockManagers' => 'array[]',
125 'wgForeignFileRepos' => 'array[]',
126 'wgDefaultUserOptions' => 'array',
127 'wgSkipSkins' => 'string[]',
128 'wgLogTypes' => 'string[]',
129 'wgLogNames' => 'array<string,string>',
130 'wgLogHeaders' => 'array<string,string>',
131 'wgLogActionsHandlers' => 'array<string,class-string>',
132 'wgPasswordPolicy' => 'array<string,array<string,string|array>>',
133 'wgVirtualRestConfig' => 'array<string,array>',
134 'wgWANObjectCaches' => 'array[]',
135 'wgLocalInterwikis' => 'string[]',
136 'wgDebugLogGroups' => 'string|false|array{destination:string,sample?:int,level:int}',
137 'wgCookiePrefix' => 'string|false',
138 'wgOut' => 'OutputPage',
139 'wgExtraNamespaces' => 'string[]',
140 ] );
141
142 return $cfg;