From 5142c5d91e802575eac70b1bc1e693e6fc9235a3 Mon Sep 17 00:00:00 2001 From: lens0021 Date: Sat, 26 Sep 2020 12:36:50 +0900 Subject: [PATCH] Fix Phan errors (cherry picked from commit 9031ff70096045839ab45050b954103349474dbb) --- includes/SanctionsHooks.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/includes/SanctionsHooks.php b/includes/SanctionsHooks.php index 40aaad7..f02f361 100644 --- a/includes/SanctionsHooks.php +++ b/includes/SanctionsHooks.php @@ -2,6 +2,8 @@ use Flow\Exception\InvalidInputException; use Flow\Model\UUID; +use MediaWiki\Revision\RevisionRecord; +use MediaWiki\User\UserIdentity; class SanctionsHooks { /** @@ -210,7 +212,7 @@ public static function onUserToolLinksEdit( $userId, $userText, &$items ) { * @return bool|void True or no return value to continue or false to abort */ public static function onDiffTools( $newRevRecord, &$links, $oldRevRecord, $userIdentity ) { - if ( $userIdentity == null || !SanctionsUtils::hasVoteRight( $userIdentity ) ) { + if ( !SanctionsUtils::hasVoteRight( User::newFromIdentity( $userIdentity ) ) ) { return true; } @@ -238,7 +240,7 @@ public static function onDiffTools( $newRevRecord, &$links, $oldRevRecord, $user * @return bool|void True or no return value to continue or false to abort */ public static function onHistoryTools( $revRecord, &$links, $prevRevRecord, $userIdentity ) { - if ( $userIdentity == null || !SanctionsUtils::hasVoteRight( $userIdentity ) ) { + if ( !SanctionsUtils::hasVoteRight( User::newFromIdentity( $userIdentity ) ) ) { return true; }