Migrate to new Phan

Bug: T216942
Change-Id: I92c55f8af579a92baa02d9bd1b25b8290f0cd196
This commit is contained in:
Daimona Eaytoy 2019-03-02 13:28:18 +01:00 committed by Umherirrender
parent f3ff95ce08
commit 25b65a40fe
7 changed files with 23 additions and 22 deletions

1
.gitignore vendored
View file

@ -21,4 +21,3 @@ project.index
## Sublime ## Sublime
sublime-* sublime-*
sftp-config.json sftp-config.json
tests/phan/issues

19
.phan/config.php Normal file
View file

@ -0,0 +1,19 @@
<?php
$cfg = require __DIR__ . '/../vendor/mediawiki/mediawiki-phan-config/src/config.php';
$cfg['directory_list'] = array_merge(
$cfg['directory_list'],
[
'../../extensions/CheckUser',
'../../extensions/EventLogging',
]
);
$cfg['exclude_analysis_directory_list'] = array_merge(
$cfg['exclude_analysis_directory_list'],
[
'../../extensions/CheckUser',
'../../extensions/EventLogging',
]
);
return $cfg;

View file

@ -4,7 +4,7 @@
"jakub-onderka/php-console-highlighter": "0.3.2", "jakub-onderka/php-console-highlighter": "0.3.2",
"mediawiki/mediawiki-codesniffer": "24.0.0", "mediawiki/mediawiki-codesniffer": "24.0.0",
"mediawiki/minus-x": "0.3.2", "mediawiki/minus-x": "0.3.2",
"mediawiki/mediawiki-phan-config": "0.3.0" "mediawiki/mediawiki-phan-config": "0.4.0"
}, },
"scripts": { "scripts": {
"fix": [ "fix": [

View file

@ -173,6 +173,7 @@ abstract class BaseBlacklist {
} }
} }
// @phan-suppress-next-line PhanTypeMismatchForeach += makes Phan think $files is a number
foreach ( $files as $fileName ) { foreach ( $files as $fileName ) {
$matches = []; $matches = [];
if ( preg_match( '/^DB: (\w*) (.*)$/', $fileName, $matches ) ) { if ( preg_match( '/^DB: (\w*) (.*)$/', $fileName, $matches ) ) {

View file

@ -61,6 +61,7 @@ class SpamRegexBatch {
private static function validateRegexes( $regexes ) { private static function validateRegexes( $regexes ) {
foreach ( $regexes as $regex ) { foreach ( $regexes as $regex ) {
Wikimedia\suppressWarnings(); Wikimedia\suppressWarnings();
// @phan-suppress-next-line PhanParamSuspiciousOrder False positive
$ok = preg_match( $regex, '' ); $ok = preg_match( $regex, '' );
Wikimedia\restoreWarnings(); Wikimedia\restoreWarnings();

View file

@ -71,7 +71,7 @@ class Cleanup extends Maintenance {
* Find the latest revision of the article that does not contain spam and revert to it * Find the latest revision of the article that does not contain spam and revert to it
* @param Revision $rev * @param Revision $rev
* @param array $regexes * @param array $regexes
* @param array $match * @param string $match
* @param User $user * @param User $user
*/ */
private function cleanupArticle( Revision $rev, $regexes, $match, User $user ) { private function cleanupArticle( Revision $rev, $regexes, $match, User $user ) {

View file

@ -1,19 +0,0 @@
<?php
$cfg = require __DIR__ . '/../../vendor/mediawiki/mediawiki-phan-config/src/config.php';
$cfg['directory_list'] = array_merge(
$cfg['directory_list'],
[
'./../../extensions/CheckUser',
'./../../extensions/EventLogging',
]
);
$cfg['exclude_analysis_directory_list'] = array_merge(
$cfg['exclude_analysis_directory_list'],
[
'./../../extensions/CheckUser',
'./../../extensions/EventLogging',
]
);
return $cfg;