Change-Id: I65ae6adc10941c05a2646e551b1baa829e4e8654
This commit is contained in:
Daimona Eaytoy 2019-03-11 14:25:18 +01:00
parent 0053181835
commit e21e3b4a8d
9 changed files with 39 additions and 6 deletions

21
.phan/config.php Normal file
View file

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

View file

@ -3,7 +3,8 @@
"jakub-onderka/php-parallel-lint": "1.0.0",
"mediawiki/mediawiki-codesniffer": "24.0.0",
"jakub-onderka/php-console-highlighter": "0.3.2",
"mediawiki/minus-x": "0.3.1"
"mediawiki/minus-x": "0.3.1",
"mediawiki/mediawiki-phan-config": "0.5.0"
},
"scripts": {
"test": [

View file

@ -1506,6 +1506,15 @@ class EchoHooks {
return true;
}
/**
* @param WikiPage &$article
* @param User &$user
* @param string $reason
* @param int $articleId
* @param Content|null $content
* @param LogEntry $logEntry
* @suppress PhanParamReqAfterOpt
*/
public static function onArticleDeleteComplete(
WikiPage &$article,
User &$user,
@ -1519,7 +1528,6 @@ class EchoHooks {
$eventIds = $eventMapper->fetchIdsByPage( $articleId );
EchoModerationController::moderate( $eventIds, true );
} );
return true;
}
public static function onArticleUndelete( Title $title, $create, $comment, $oldPageId ) {

View file

@ -115,6 +115,7 @@ class EchoForeignWikiRequest {
* This method fetches the tokens for all requested wikis at once and caches the result.
*
* @param string $wiki Name of the wiki to get a token for
* @suppress PhanTypeInvalidCallableArraySize getRequestParams can take an array, too (phan bug)
* @return string Token
*/
protected function getCsrfToken( $wiki ) {

View file

@ -1,5 +1,5 @@
<?php
// @phan-file-suppress PhanUndeclaredMethod This is a trait, and phan is confused by $this
/**
* Trait that adds cross-wiki functionality to an API module. For mixing into ApiBase subclasses.
*

View file

@ -18,6 +18,7 @@ class EchoModelFormatter extends EchoEventFormatter {
}
foreach ( $data['links']['secondary'] as &$link ) {
// @phan-suppress-next-line PhanTypeMismatchDimAssignment
$link['url'] = wfExpandUrl( $link['url'] );
}

View file

@ -79,7 +79,7 @@ class EchoNotificationMapper extends EchoAbstractMapper {
array $titles = null,
$dbSource = DB_REPLICA
) {
$conds['notification_read_timestamp'] = null;
$conds = [ 'notification_read_timestamp' => null ];
if ( $titles ) {
$conds['event_page_id'] = $this->getIdsForTitles( $titles );
if ( !$conds['event_page_id'] ) {

View file

@ -197,6 +197,7 @@ class SpecialNotifications extends SpecialPage {
// is an array
$notices
->appendContent( $heading )
// @phan-suppress-next-line PhanTypeMismatchArgument Phan troubles with variadic args
->appendContent( $data[ 'notices' ] );
}

View file

@ -1,6 +1,6 @@
<?php
// phpcs:disable Generic.Files.LineLength -- Long html test examples
// @phan-file-suppress PhanUndeclaredClassMethod, PhanUndeclaredClassConstant Other extensions used for testing purposes
use Wikibase\Client\Hooks\EchoNotificationsHandlers;
@ -391,7 +391,7 @@ class GenerateSampleNotifications extends Maintenance {
}
private function generateOpenStackManager( User $user, User $agent ) {
if ( !class_exists( OpenStackManagerHooks::class ) ) {
if ( !ExtensionRegistry::getInstance()->isLoaded( 'OpenStackManager' ) ) {
return;
}