Unsuppress more phan issues (part 5)
authorDaimona Eaytoy <daimona.wiki@gmail.com>
Fri, 30 Aug 2019 17:56:27 +0000 (19:56 +0200)
committerDaimona Eaytoy <daimona.wiki@gmail.com>
Sun, 1 Sep 2019 09:48:31 +0000 (09:48 +0000)
Bug: T231636
Depends-On: I6e5fba7bd273219b1206559420b5bdb78734aa84
Change-Id: I50377746f01749b058c39fd8229f9d566224cc43

47 files changed:
.phan/config.php
includes/EditPage.php
includes/FileDeleteForm.php
includes/LinkFilter.php
includes/Linker.php
includes/Setup.php
includes/Title.php
includes/api/ApiAuthManagerHelper.php
includes/api/ApiBlock.php
includes/api/ApiEditPage.php
includes/api/ApiPageSet.php
includes/api/ApiQueryBacklinks.php
includes/api/ApiQueryDeletedrevs.php
includes/api/ApiUnblock.php
includes/api/ApiUndelete.php
includes/api/ApiUpload.php
includes/api/ApiUserrights.php
includes/api/ApiValidatePassword.php
includes/api/SearchApi.php
includes/auth/AuthenticationRequest.php
includes/auth/Throttler.php
includes/changes/EnhancedChangesList.php
includes/content/ContentHandler.php
includes/content/FileContentHandler.php
includes/filerepo/file/LocalFile.php
includes/htmlform/HTMLForm.php
includes/installer/Installer.php
includes/jobqueue/JobQueueGroup.php
includes/libs/XhprofData.php
includes/libs/objectcache/MultiWriteBagOStuff.php
includes/libs/objectcache/wancache/WANObjectCache.php
includes/media/IPTC.php
includes/page/Article.php
includes/preferences/DefaultPreferencesFactory.php
includes/search/SearchEngine.php
includes/specialpage/AuthManagerSpecialPage.php
includes/specials/SpecialContributions.php
includes/specials/SpecialEditWatchlist.php
includes/specials/SpecialMovepage.php
includes/specials/SpecialUndelete.php
includes/specials/SpecialWhatLinksHere.php
includes/specials/pagers/BlockListPager.php
maintenance/categoryChangesAsRdf.php
maintenance/includes/TextPassDumper.php
maintenance/populateArchiveRevId.php
maintenance/updateCollation.php
maintenance/updateExtensionJsonSchema.php

index 29729ae..6405cec 100644 (file)
@@ -82,8 +82,6 @@ $cfg['suppress_issue_types'] = array_merge( $cfg['suppress_issue_types'], [
        "PhanParamReqAfterOpt",
        // approximate error count: 110
        "PhanParamTooMany",
-       // approximate error count: 63
-       "PhanTypeArraySuspicious",
        // approximate error count: 88
        "PhanTypeInvalidDimOffset",
        // approximate error count: 60
@@ -94,8 +92,6 @@ $cfg['suppress_issue_types'] = array_merge( $cfg['suppress_issue_types'], [
        "PhanUndeclaredMethod",
        // approximate error count: 752
        "PhanUndeclaredProperty",
-       // approximate error count: 53
-       "PhanUndeclaredVariableDim",
 ] );
 
 $cfg['ignore_undeclared_variables_in_global_scope'] = true;
@@ -103,6 +99,20 @@ $cfg['globals_type_map'] = array_merge( $cfg['globals_type_map'], [
        'IP' => 'string',
        'wgGalleryOptions' => 'array',
        'wgDummyLanguageCodes' => 'string[]',
+       'wgNamespaceProtection' => 'array<string,string|string[]>',
+       'wgNamespaceAliases' => 'array<string,int>',
+       'wgLockManagers' => 'array[]',
+       'wgForeignFileRepos' => 'array[]',
+       'wgDefaultUserOptions' => 'array',
+       'wgSkipSkins' => 'string[]',
+       'wgLogTypes' => 'string[]',
+       'wgLogNames' => 'array<string,string>',
+       'wgLogHeaders' => 'array<string,string>',
+       'wgLogActionsHandlers' => 'array<string,class-string>',
+       'wgPasswordPolicy' => 'array<string,array<string,string|array>>',
+       'wgVirtualRestConfig' => 'array<string,array>',
+       'wgWANObjectCaches' => 'array[]',
+       'wgLocalInterwikis' => 'string[]',
 ] );
 
 return $cfg;
index f066a61..541541a 100644 (file)
@@ -4166,7 +4166,7 @@ ERROR;
         *  - 'legacy-name' (optional): short name for backwards-compatibility
         * @param array $checked Array of checkbox name (matching the 'legacy-name') => bool,
         *   where bool indicates the checked status of the checkbox
-        * @return array
+        * @return array[]
         */
        public function getCheckboxesDefinition( $checked ) {
                $checkboxes = [];
index 8272ccf..56cfd59 100644 (file)
@@ -261,6 +261,7 @@ class FileDeleteForm {
                );
                $options = Xml::listDropDownOptionsOoui( $options );
 
+               $fields = [];
                $fields[] = new OOUI\LabelWidget( [ 'label' => new OOUI\HtmlSnippet(
                        $this->prepareMessage( 'filedelete-intro' ) ) ]
                );
index 7e1b44d..c46df94 100644 (file)
@@ -338,6 +338,7 @@ class LinkFilter {
                        }
                }
 
+               $like = [];
                $like[] = $bits['scheme'] . $bits['delimiter'] . $bits['host'];
 
                if ( $subdomains ) {
index 03d2516..e748b3a 100644 (file)
@@ -1040,7 +1040,7 @@ class Linker {
                }
 
                $userTalkPage = new TitleValue( NS_USER_TALK, strtr( $userText, ' ', '_' ) );
-               $moreLinkAttribs['class'] = 'mw-usertoollinks-talk';
+               $moreLinkAttribs = [ 'class' => 'mw-usertoollinks-talk' ];
 
                return self::link( $userTalkPage,
                        wfMessage( 'talkpagelinktext' )->escaped(),
@@ -1062,7 +1062,7 @@ class Linker {
                }
 
                $blockPage = SpecialPage::getTitleFor( 'Block', $userText );
-               $moreLinkAttribs['class'] = 'mw-usertoollinks-block';
+               $moreLinkAttribs = [ 'class' => 'mw-usertoollinks-block' ];
 
                return self::link( $blockPage,
                        wfMessage( 'blocklink' )->escaped(),
@@ -1083,7 +1083,7 @@ class Linker {
                }
 
                $emailPage = SpecialPage::getTitleFor( 'Emailuser', $userText );
-               $moreLinkAttribs['class'] = 'mw-usertoollinks-mail';
+               $moreLinkAttribs = [ 'class' => 'mw-usertoollinks-mail' ];
                return self::link( $emailPage,
                        wfMessage( 'emaillink' )->escaped(),
                        $moreLinkAttribs
index c1c6ef2..1e65f52 100644 (file)
@@ -386,6 +386,7 @@ $wgSkipSkins[] = 'apioutput';
 if ( $wgLocalInterwiki ) {
        // Hard deprecated in 1.34.
        wfDeprecated( '$wgLocalInterwiki – use $wgLocalInterwikis instead', '1.23' );
+       // @phan-suppress-next-line PhanUndeclaredVariableDim
        array_unshift( $wgLocalInterwikis, $wgLocalInterwiki );
 }
 
index 1acc7af..f621e66 100644 (file)
@@ -2955,7 +2955,7 @@ class Title implements LinkTarget, IDBAccessObject {
                }
 
                $dbr = wfGetDB( DB_REPLICA );
-               $conds['page_namespace'] = $this->mNamespace;
+               $conds = [ 'page_namespace' => $this->mNamespace ];
                $conds[] = 'page_title ' . $dbr->buildLike( $this->mDbkeyform . '/', $dbr->anyString() );
                $options = [];
                if ( $limit > -1 ) {
index 7a548cc..9a3f75e 100644 (file)
@@ -307,6 +307,9 @@ class ApiAuthManagerHelper {
        /**
         * Clean up a field array for output
         * @param array $fields
+        * @codingStandardsIgnoreStart
+        * @phan-param array{type:string,options:array,value:string,label:Message,help:Message,optional:bool,sensitive:bool,skippable:bool} $fields
+        * @codingStandardsIgnoreEnd
         * @return array
         */
        private function formatFields( array $fields ) {
index 2c1564e..755f319 100644 (file)
@@ -141,6 +141,7 @@ class ApiBlock extends ApiBase {
                }
 
                list( $target, /*...*/ ) = SpecialBlock::getTargetAndType( $params['user'] );
+               $res = [];
                $res['user'] = $params['user'];
                $res['userID'] = $target instanceof User ? $target->getId() : 0;
 
index e631e3f..fdf9cf1 100644 (file)
@@ -378,6 +378,7 @@ class ApiEditPage extends ApiBase {
                $status = $ep->attemptSave( $result );
                $wgRequest = $oldRequest;
 
+               $r = [];
                switch ( $status->value ) {
                        case EditPage::AS_HOOK_ERROR:
                        case EditPage::AS_HOOK_ERROR_EXPECTED:
index c604322..6afb018 100644 (file)
@@ -77,6 +77,7 @@ class ApiPageSet extends ApiBase {
        private $mGeneratorData = []; // [ns][dbkey] => data array
        private $mFakePageId = -1;
        private $mCacheMode = 'public';
+       /** @var array */
        private $mRequestedPageFields = [];
        /** @var int */
        private $mDefaultNamespace = NS_MAIN;
index f82a559..0cda960 100644 (file)
@@ -306,7 +306,7 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
                        }
 
                        if ( is_null( $resultPageSet ) ) {
-                               $a['pageid'] = (int)$row->page_id;
+                               $a = [ 'pageid' => (int)$row->page_id ];
                                ApiQueryBase::addTitleInfo( $a, Title::makeTitle( $row->page_namespace, $row->page_title ) );
                                if ( $row->page_is_redirect ) {
                                        $a['redirect'] = true;
index 1af4d95..eb787d1 100644 (file)
@@ -368,7 +368,7 @@ class ApiQueryDeletedrevs extends ApiQueryBase {
                        if ( !isset( $pageMap[$row->ar_namespace][$row->ar_title] ) ) {
                                $pageID = $newPageID++;
                                $pageMap[$row->ar_namespace][$row->ar_title] = $pageID;
-                               $a['revisions'] = [ $rev ];
+                               $a = [ 'revisions' => [ $rev ] ];
                                ApiResult::setIndexedTagName( $a['revisions'], 'rev' );
                                $title = Title::makeTitle( $row->ar_namespace, $row->ar_title );
                                ApiQueryBase::addTitleInfo( $a, $title );
index 0718ac8..15c2564 100644 (file)
@@ -86,11 +86,13 @@ class ApiUnblock extends ApiBase {
                        $this->dieStatus( $this->errorArrayToStatus( $retval ) );
                }
 
-               $res['id'] = $block->getId();
                $target = $block->getType() == DatabaseBlock::TYPE_AUTO ? '' : $block->getTarget();
-               $res['user'] = $target instanceof User ? $target->getName() : $target;
-               $res['userid'] = $target instanceof User ? $target->getId() : 0;
-               $res['reason'] = $params['reason'];
+               $res = [
+                       'id' => $block->getId(),
+                       'user' => $target instanceof User ? $target->getName() : $target,
+                       'userid' => $target instanceof User ? $target->getId() : 0,
+                       'reason' => $params['reason']
+               ];
                $this->getResult()->addValue( null, $this->getModuleName(), $res );
        }
 
index ba9be81..9ef17e6 100644 (file)
@@ -84,10 +84,12 @@ class ApiUndelete extends ApiBase {
 
                $this->setWatch( $params['watchlist'], $titleObj );
 
-               $info['title'] = $titleObj->getPrefixedText();
-               $info['revisions'] = (int)$retval[0];
-               $info['fileversions'] = (int)$retval[1];
-               $info['reason'] = $retval[2];
+               $info = [
+                       'title' => $titleObj->getPrefixedText(),
+                       'revisions' => (int)$retval[0],
+                       'fileversions' => (int)$retval[1],
+                       'reason' => $retval[2]
+               ];
                $this->getResult()->addValue( null, $this->getModuleName(), $info );
        }
 
index b15b998..3a54772 100644 (file)
@@ -793,6 +793,7 @@ class ApiUpload extends ApiBase {
                        }
                }
 
+               $result = [];
                // No errors, no warnings: do the upload
                if ( $this->mParams['async'] ) {
                        $progress = UploadBase::getSessionStatus( $this->getUser(), $this->mParams['filekey'] );
index 89ec6cb..3aaae70 100644 (file)
@@ -112,6 +112,7 @@ class ApiUserrights extends ApiBase {
 
                $form = $this->getUserRightsPage();
                $form->setContext( $this->getContext() );
+               $r = [];
                $r['user'] = $user->getName();
                $r['userid'] = $user->getId();
                list( $r['added'], $r['removed'] ) = $form->doSaveUserGroups(
index 943149d..c36759a 100644 (file)
@@ -33,6 +33,7 @@ class ApiValidatePassword extends ApiBase {
                        $user = $this->getUser();
                }
 
+               $r = [];
                $validity = $user->checkPasswordValidity( $params['password'] );
                $r['validity'] = $validity->isGood() ? 'Good' : ( $validity->isOK() ? 'Change' : 'Invalid' );
                $messages = array_merge(
index 02abb1e..6f46c56 100644 (file)
@@ -99,6 +99,7 @@ trait SearchApi {
         *
         * @return array array containing available additional api param definitions.
         *  Empty if profiles are not supported by the searchEngine implementation.
+        * @suppress PhanTypeMismatchDimFetch
         */
        private function buildProfileApiParam() {
                $configs = $this->getSearchProfileParams();
@@ -119,6 +120,7 @@ trait SearchApi {
                                if ( isset( $profile['desc-message'] ) ) {
                                        $helpMessages[$profile['name']] = $profile['desc-message'];
                                }
+
                                if ( !empty( $profile['default'] ) ) {
                                        $defaultProfile = $profile['name'];
                                }
index f59760a..74ce60a 100644 (file)
@@ -122,6 +122,7 @@ abstract class AuthenticationRequest {
         * a 'password' field).
         *
         * @return array As above
+        * @phan-return array<string,array{type:string,options?:array,value?:string,label:Message,help:Message,optional?:bool,sensitive?:bool,skippable?:bool}>
         */
        abstract public function getFieldInfo();
 
@@ -337,7 +338,6 @@ abstract class AuthenticationRequest {
                                }
 
                                $options['sensitive'] = !empty( $options['sensitive'] );
-                               // @phan-suppress-next-line PhanTypeArraySuspiciousNullable
                                $type = $options['type'];
 
                                if ( !array_key_exists( $name, $merged ) ) {
index 9d0175a..7128fe2 100644 (file)
@@ -40,7 +40,7 @@ class Throttler implements LoggerAwareInterface {
        /**
         * See documentation of $wgPasswordAttemptThrottle for format. Old (pre-1.27) format is not
         * allowed here.
-        * @var array
+        * @var array[]
         * @see https://www.mediawiki.org/wiki/Manual:$wgPasswordAttemptThrottle
         */
        protected $conditions;
@@ -179,7 +179,7 @@ class Throttler implements LoggerAwareInterface {
        /**
         * Handles B/C for $wgPasswordAttemptThrottle.
         * @param array $throttleConditions
-        * @return array
+        * @return array[]
         * @see $wgPasswordAttemptThrottle for structure
         */
        protected static function normalizeThrottleConditions( $throttleConditions ) {
index 62cf39e..e461762 100644 (file)
@@ -265,7 +265,7 @@ class EnhancedChangesList extends ChangesList {
                                $block[0], $block[0]->unpatrolled, $block[0]->watched );
                }
 
-               $queryParams['curid'] = $curId;
+               $queryParams = [ 'curid' => $curId ];
 
                # Sub-entries
                $lines = [];
@@ -632,7 +632,7 @@ class EnhancedChangesList extends ChangesList {
        protected function recentChangesBlockLine( $rcObj ) {
                $data = [];
 
-               $query['curid'] = $rcObj->mAttribs['rc_cur_id'];
+               $query = [ 'curid' => $rcObj->mAttribs['rc_cur_id'] ];
 
                $type = $rcObj->mAttribs['rc_type'];
                $logType = $rcObj->mAttribs['rc_log_type'];
index 100fa83..f1df087 100644 (file)
@@ -1260,6 +1260,7 @@ abstract class ContentHandler {
         * @since 1.28
         */
        public function getFieldsForSearchIndex( SearchEngine $engine ) {
+               $fields = [];
                $fields['category'] = $engine->makeSearchFieldMapping(
                        'category',
                        SearchIndexField::INDEX_TYPE_TEXT
index 6a1cc62..f3f9a97 100644 (file)
@@ -11,6 +11,7 @@ use MediaWiki\MediaWikiServices;
 class FileContentHandler extends WikitextContentHandler {
 
        public function getFieldsForSearchIndex( SearchEngine $engine ) {
+               $fields = [];
                $fields['file_media_type'] =
                        $engine->makeSearchFieldMapping( 'file_media_type', SearchIndexField::INDEX_TYPE_KEYWORD );
                $fields['file_media_type']->setFlag( SearchIndexField::FLAG_CASEFOLD );
index f3116e2..2890360 100644 (file)
@@ -344,6 +344,7 @@ class LocalFile extends File {
                                $this->loadFromDB( self::READ_NORMAL );
 
                                $fields = $this->getCacheFields( '' );
+                               $cacheVal = [];
                                $cacheVal['fileExists'] = $this->fileExists;
                                if ( $this->fileExists ) {
                                        foreach ( $fields as $field ) {
index f4dad39..04be6c4 100644 (file)
@@ -242,6 +242,10 @@ class HTMLForm extends ContextSource {
 
        protected $mUseMultipart = false;
        protected $mHiddenFields = [];
+       /**
+        * @var array[]
+        * @phan-var array<array{name:string,value:string,label-message?:string,label?:string,label-raw?:string,id?:string,attribs?:array,flags?:string|string[],framed?:bool}>
+        */
        protected $mButtons = [];
 
        protected $mWrapperLegend = false;
@@ -983,6 +987,9 @@ class HTMLForm extends ContextSource {
         *  - attribs: (array, optional) Additional HTML attributes.
         *  - flags: (string|string[], optional) OOUI flags.
         *  - framed: (boolean=true, optional) OOUI framed attribute.
+        * @codingStandardsIgnoreStart
+        * @phan-param array{name:string,value:string,label-message?:string,label?:string,label-raw?:string,id?:string,attribs?:array,flags?:string|string[],framed?:bool} $data
+        * @codingStandardsIgnoreEnd
         * @return HTMLForm $this for chaining calls (since 1.20)
         */
        public function addButton( $data ) {
index a3951a1..c719c76 100644 (file)
@@ -1270,7 +1270,7 @@ abstract class Installer {
         *
         * @param string $directory Directory to search in, relative to $IP, must be either "extensions"
         *     or "skins"
-        * @return array [ $extName => [ 'screenshots' => [ '...' ] ]
+        * @return array[][] [ $extName => [ 'screenshots' => [ '...' ] ]
         */
        public function findExtensions( $directory = 'extensions' ) {
                switch ( $directory ) {
index 06cd04c..7bc97d8 100644 (file)
@@ -397,7 +397,8 @@ class JobQueueGroup {
        }
 
        /**
-        * @return JobQueue[]
+        * @return array[]
+        * @phan-return array<string,array{queue:JobQueue,types:array<string,class-string>}>
         */
        protected function getCoalescedQueues() {
                global $wgJobTypeConf;
index 90e52f0..56e6b19 100644 (file)
@@ -43,13 +43,13 @@ class XhprofData {
 
        /**
         * Per-function inclusive data.
-        * @var array $inclusive
+        * @var array[] $inclusive
         */
        protected $inclusive;
 
        /**
         * Per-function inclusive and exclusive data.
-        * @var array $complete
+        * @var array[] $complete
         */
        protected $complete;
 
@@ -153,7 +153,7 @@ class XhprofData {
         * - max: Maximum value
         * - variance: Variance (spread) of the values
         *
-        * @return array
+        * @return array[]
         * @see getRawData()
         * @see getCompleteMetrics()
         */
@@ -239,7 +239,7 @@ class XhprofData {
         * metrics have an additional 'exclusive' measurement which is the total
         * minus the totals of all child function calls.
         *
-        * @return array
+        * @return array[]
         * @see getRawData()
         * @see getInclusiveMetrics()
         */
index d0aa380..51f7316 100644 (file)
@@ -61,6 +61,7 @@ class MultiWriteBagOStuff extends BagOStuff {
         *      invalidation uses logical TTLs, invalidation uses etag/timestamp
         *      validation against the DB, or merge() is used to handle races.
         * @param array $params
+        * @phan-param array{caches:array<int,array|BagOStuff>,replication:string} $params
         * @throws InvalidArgumentException
         */
        public function __construct( $params ) {
index b88b496..3321254 100644 (file)
@@ -1305,6 +1305,7 @@ class WANObjectCache implements IExpiringStore, IStoreKeyEncoder, LoggerAwareInt
         *   - Cached or regenerated value version number or null if not versioned
         *   - Timestamp of the current cached value at the key or null if there is no value
         * @note Callable type hints are not used to avoid class-autoloading
+        * @suppress PhanTypeArraySuspicious
         */
        private function fetchOrRegenerate( $key, $ttl, $callback, array $opts ) {
                $checkKeys = $opts['checkKeys'] ?? [];
@@ -2421,6 +2422,7 @@ class WANObjectCache implements IExpiringStore, IStoreKeyEncoder, LoggerAwareInt
         *   - curTTL: remaining time-to-live (negative if tombstoned) or null if there is no value
         *   - version: value version number or null if the if there is no value
         *   - tombAsOf: UNIX timestamp of the tombstone or null if there is no tombstone
+        * @phan-return array{0:mixed,1:array{asOf:?mixed,curTTL:?int|float,version:?mixed,tombAsOf:?mixed}}
         */
        private function unwrap( $wrapped, $now ) {
                $value = false;
index 683ded1..c32db28 100644 (file)
@@ -36,6 +36,7 @@ class IPTC {
         *
         * @param string $rawData The app13 block from jpeg containing iptc/iim data
         * @return array IPTC metadata array
+        * @suppress PhanTypeArraySuspicious
         */
        static function parse( $rawData ) {
                $parsed = iptcparse( $rawData );
index d8cd1c5..3628c7b 100644 (file)
@@ -1935,6 +1935,7 @@ class Article implements Page {
                );
                $options = Xml::listDropDownOptionsOoui( $options );
 
+               $fields = [];
                $fields[] = new OOUI\FieldLayout(
                        new OOUI\DropdownInputWidget( [
                                'name' => 'wpDeleteReasonList',
index 70e38ee..8c44a5e 100644 (file)
@@ -540,6 +540,7 @@ class DefaultPreferencesFactory implements PreferencesFactory {
 
                if ( $this->options->get( 'EnableEmail' ) ) {
                        if ( $canViewPrivateInfo ) {
+                               $helpMessages = [];
                                $helpMessages[] = $this->options->get( 'EmailConfirmToEdit' )
                                                ? 'prefs-help-email-required'
                                                : 'prefs-help-email';
index 87a7861..66e59e5 100644 (file)
@@ -727,6 +727,7 @@ abstract class SearchEngine {
         * @param string $profileType the type of profiles
         * @param User|null $user the user requesting the list of profiles
         * @return array|null the list of profiles or null if none available
+        * @phan-return null|array{name:string,desc-message:string,default?:bool}
         */
        public function getProfiles( $profileType, User $user = null ) {
                return null;
index e1f0588..9934150 100644 (file)
@@ -509,7 +509,7 @@ abstract class AuthManagerSpecialPage extends SpecialPage {
         * Generates a HTMLForm descriptor array from a set of authentication requests.
         * @param AuthenticationRequest[] $requests
         * @param string $action AuthManager action name (one of the AuthManager::ACTION_* constants)
-        * @return array
+        * @return array[]
         */
        protected function getAuthFormDescriptor( $requests, $action ) {
                $fieldInfo = AuthenticationRequest::mergeFieldInfo( $requests );
@@ -600,7 +600,7 @@ abstract class AuthManagerSpecialPage extends SpecialPage {
        /**
         * Adds a sequential tabindex starting from 1 to all form elements. This way the user can
         * use the tab key to traverse the form without having to step through all links and such.
-        * @param array &$formDescriptor
+        * @param array[] &$formDescriptor
         */
        protected function addTabIndex( &$formDescriptor ) {
                $i = 1;
index 9d5f430..1753831 100644 (file)
@@ -364,6 +364,7 @@ class SpecialContributions extends IncludableSpecialPage {
 
                $linkRenderer = $sp->getLinkRenderer();
 
+               $tools = [];
                # No talk pages for IP ranges.
                if ( !$isRange ) {
                        $tools['user-talk'] = $linkRenderer->makeLink(
index 480e81a..717edc3 100644 (file)
@@ -639,6 +639,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
                $linkRenderer = $this->getLinkRenderer();
                $link = $linkRenderer->makeLink( $title );
 
+               $tools = [];
                $tools['talk'] = $linkRenderer->makeLink(
                        $title->getTalkPage(),
                        $this->msg( 'talkpagelinktext' )->text()
index 0cb3bba..941d108 100644 (file)
@@ -285,11 +285,9 @@ class MovePageForm extends UnlistedSpecialPage {
                        # Is the title semi-protected?
                        if ( $this->oldTitle->isSemiProtected( 'move' ) ) {
                                $noticeMsg = 'semiprotectedpagemovewarning';
-                               $classes[] = 'mw-textarea-sprotected';
                        } else {
                                # Then it must be protected based on static groups (regular)
                                $noticeMsg = 'protectedpagemovewarning';
-                               $classes[] = 'mw-textarea-protected';
                        }
                        $out->addHTML( "<div class='mw-warning-with-logexcerpt'>\n" );
                        $out->addWikiMsg( $noticeMsg );
index 9a16a72..32be932 100644 (file)
@@ -247,6 +247,7 @@ class SpecialUndelete extends SpecialPage {
 
                $out->enableOOUI();
 
+               $fields = [];
                $fields[] = new OOUI\ActionFieldLayout(
                        new OOUI\TextInputWidget( [
                                'name' => 'prefix',
@@ -768,6 +769,7 @@ class SpecialUndelete extends SpecialPage {
                }
 
                if ( $this->mAllowed && ( $haveRevisions || $haveFiles ) ) {
+                       $fields = [];
                        $fields[] = new OOUI\Layout( [
                                'content' => new OOUI\HtmlSnippet( $this->msg( 'undeleteextrahelp' )->parseAsBlock() )
                        ] );
index 18c10bf..2840086 100644 (file)
@@ -117,6 +117,7 @@ class SpecialWhatLinksHere extends IncludableSpecialPage {
                $fetchlinks = ( !$hidelinks || !$hideredirs );
 
                // Build query conds in concert for all three tables...
+               $conds = [];
                $conds['pagelinks'] = [
                        'pl_namespace' => $target->getNamespace(),
                        'pl_title' => $target->getDBkey(),
@@ -229,6 +230,7 @@ class SpecialWhatLinksHere extends IncludableSpecialPage {
                // Read the rows into an array and remove duplicates
                // templatelinks comes second so that the templatelinks row overwrites the
                // pagelinks row, so we get (inclusion) rather than nothing
+               $rows = [];
                if ( $fetchlinks ) {
                        foreach ( $plRes as $row ) {
                                $row->is_template = 0;
index d61a1be..6faf22b 100644 (file)
@@ -74,7 +74,7 @@ class BlockListPager extends TablePager {
         * @param string $name
         * @param string $value
         * @return string
-        * @suppress PhanTypeArraySuspiciousNullable
+        * @suppress PhanTypeArraySuspiciousNullable,PhanTypeArraySuspicious
         */
        function formatValue( $name, $value ) {
                static $msg = null;
@@ -138,6 +138,7 @@ class BlockListPager extends TablePager {
                                        /* User preference timezone */true
                                ) );
                                if ( $this->getUser()->isAllowed( 'block' ) ) {
+                                       $links = [];
                                        if ( $row->ipb_auto ) {
                                                $links[] = $linkRenderer->makeKnownLink(
                                                        SpecialPage::getTitleFor( 'Unblock' ),
index c4f175f..f794abb 100644 (file)
@@ -595,6 +595,8 @@ SPARQL;
                         * TODO: For now, we do full update even though some data hasn't changed,
                         * e.g. parents for parent cat and counts for child cat.
                         */
+                       $childPages = [];
+                       $parentCats = [];
                        foreach ( $batch as $row ) {
                                $childPages[$row->rc_cur_id] = true;
                                $parentCats[$row->rc_title] = true;
@@ -614,7 +616,7 @@ SPARQL;
                        $pages = [];
                        $deleteUrls = [];
 
-                       if ( !empty( $childPages ) ) {
+                       if ( $childPages ) {
                                // Load child rows by ID
                                $childRows = $dbr->select(
                                        [ 'page', 'page_props', 'category' ],
@@ -642,7 +644,7 @@ SPARQL;
                                }
                        }
 
-                       if ( !empty( $parentCats ) ) {
+                       if ( $parentCats ) {
                                // Load parent rows by title
                                $joinConditions = [
                                        'page' => [
index bcf84aa..d473486 100644 (file)
@@ -303,6 +303,7 @@ TEXT
                        $param = $split[1];
                }
                $fileURIs = explode( ';', $param );
+               $newFileURIs = [];
                foreach ( $fileURIs as $URI ) {
                        switch ( $val ) {
                                case "file":
index c85e194..84b962a 100644 (file)
@@ -122,7 +122,7 @@ class PopulateArchiveRevId extends LoggedUpdateMaintenance {
                                $dbw->doAtomicSection( __METHOD__, function ( IDatabase $dbw, $fname ) {
                                        $dbw->insert( 'revision', self::$dummyRev, $fname );
                                        $id = $dbw->insertId();
-                                       $toDelete[] = $id;
+                                       $toDelete = [ $id ];
 
                                        $maxId = max(
                                                (int)$dbw->selectField( 'archive', 'MAX(ar_rev_id)', [], $fname ),
index ebace75..19fc54a 100644 (file)
@@ -104,9 +104,8 @@ TEXT
                        'STRAIGHT_JOIN' // per T58041
                ];
 
-               if ( $force ) {
-                       $collationConds = [];
-               } else {
+               $collationConds = [];
+               if ( !$force ) {
                        if ( $this->hasOption( 'previous-collation' ) ) {
                                $collationConds['cl_collation'] = $this->getOption( 'previous-collation' );
                        } else {
index a27c8a5..c9fb780 100644 (file)
@@ -18,7 +18,7 @@ class UpdateExtensionJsonSchema extends Maintenance {
                }
 
                $json = FormatJson::decode( file_get_contents( $filename ), true );
-               if ( $json === null ) {
+               if ( !is_array( $json ) ) {
                        $this->fatalError( "Error: Invalid JSON" );
                }