mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/SpamBlacklist
synced 2024-11-27 16:40:04 +00:00
Migrate to new Phan
Bug: T216942 Change-Id: I92c55f8af579a92baa02d9bd1b25b8290f0cd196
This commit is contained in:
parent
f3ff95ce08
commit
25b65a40fe
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -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
19
.phan/config.php
Normal 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;
|
|
@ -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": [
|
||||||
|
|
|
@ -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 ) ) {
|
||||||
|
|
|
@ -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();
|
||||||
|
|
||||||
|
|
|
@ -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 ) {
|
||||||
|
|
|
@ -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;
|
|
Loading…
Reference in a new issue