Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 77 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
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 | use MediaWikiPhanConfig\MediaWikiConfigBuilder; |
22 | |
23 | require_once __DIR__ . '/base-config-functions.php'; |
24 | |
25 | // Replace \\ by / for windows users to let exclude work correctly |
26 | $DIR = str_replace( '\\', '/', __DIR__ ); |
27 | |
28 | // TODO: Use \Phan\Config::projectPath() |
29 | $IP = getenv( 'MW_INSTALL_PATH' ) !== false |
30 | // Replace \\ by / for windows users to let exclude work correctly |
31 | ? str_replace( '\\', '/', getenv( 'MW_INSTALL_PATH' ) ) |
32 | : '../..'; |
33 | |
34 | $VP = getenv( 'MW_VENDOR_PATH' ) !== false |
35 | // Replace \\ by / for windows users to let exclude work correctly |
36 | ? str_replace( '\\', '/', getenv( 'MW_VENDOR_PATH' ) ) |
37 | : $IP; |
38 | |
39 | $baseCfg = new MediaWikiConfigBuilder( $IP ); |
40 | setBaseOptions( $DIR, $baseCfg ); |
41 | |
42 | $baseCfg |
43 | ->setDirectoryList( filterDirs( [ |
44 | 'includes/', |
45 | 'src/', |
46 | 'maintenance/', |
47 | '.phan/stubs/', |
48 | $IP . '/includes', |
49 | $IP . '/languages', |
50 | $IP . '/maintenance', |
51 | $IP . '/.phan/stubs/', |
52 | $VP . '/vendor', |
53 | ] ) ) |
54 | ->setExcludedDirectoryList( [ |
55 | '.phan/stubs/', |
56 | $IP . '/includes', |
57 | $IP . '/languages', |
58 | $IP . '/maintenance', |
59 | $IP . '/.phan/stubs/', |
60 | $VP . '/vendor', |
61 | |
62 | ] ) |
63 | ->setSuppressedIssuesList( [ |
64 | // Deprecation warnings |
65 | 'PhanDeprecatedFunction', |
66 | 'PhanDeprecatedClass', |
67 | 'PhanDeprecatedClassConstant', |
68 | 'PhanDeprecatedFunctionInternal', |
69 | 'PhanDeprecatedInterface', |
70 | 'PhanDeprecatedProperty', |
71 | 'PhanDeprecatedTrait', |
72 | |
73 | // Covered by codesniffer |
74 | 'PhanUnreferencedUseNormal', |
75 | 'PhanUnreferencedUseFunction', |
76 | 'PhanUnreferencedUseConstant', |
77 | 'PhanDuplicateUseNormal', |
78 | 'PhanDuplicateUseFunction', |
79 | 'PhanDuplicateUseConstant', |
80 | 'PhanUseNormalNoEffect', |
81 | 'PhanUseNormalNamespacedNoEffect', |
82 | 'PhanUseFunctionNoEffect', |
83 | 'PhanUseConstantNoEffect', |
84 | 'PhanDeprecatedCaseInsensitiveDefine', |
85 | 'PhanDeprecatedImplicitNullableParam', |
86 | |
87 | // https://github.com/phan/phan/issues/3420 |
88 | 'PhanAccessClassConstantInternal', |
89 | 'PhanAccessClassInternal', |
90 | 'PhanAccessConstantInternal', |
91 | 'PhanAccessMethodInternal', |
92 | 'PhanAccessPropertyInternal', |
93 | |
94 | // These are quite PHP8-specific |
95 | 'PhanParamNameIndicatingUnused', |
96 | 'PhanParamNameIndicatingUnusedInClosure', |
97 | 'PhanProvidingUnusedParameter', |
98 | |
99 | // Would probably have many false positives |
100 | 'PhanPluginMixedKeyNoKey', |
101 | ] ) |
102 | ->addGlobalsWithTypes( [ |
103 | 'wgContLang' => '\\MediaWiki\\Language\\Language', |
104 | 'wgParser' => '\\MediaWiki\\Parser\\Parser', |
105 | 'wgTitle' => '\\MediaWiki\\Title\\Title', |
106 | 'wgMemc' => '\\Wikimedia\ObjectCache\\BagOStuff', |
107 | 'wgUser' => '\\MediaWiki\\User\\User', |
108 | 'wgConf' => file_exists( "$IP/includes/config/SiteConfiguration.php" ) |
109 | ? '\\MediaWiki\\Config\\SiteConfiguration' : '\\SiteConfiguration', |
110 | 'wgLang' => '\\MediaWiki\\Language\\Language', |
111 | 'wgOut' => '\\MediaWiki\\Output\\OutputPage', |
112 | 'wgRequest' => file_exists( "$IP/includes/Request/WebRequest.php" ) |
113 | ? '\\MediaWiki\\Request\\WebRequest' : '\\WebRequest', |
114 | ] ) |
115 | ->enableTaintCheck( $DIR, $VP ); |
116 | |
117 | // BC: We're not ready to use the ConfigBuilder everywhere |
118 | return $baseCfg->make(); |