"PhanParamReqAfterOpt",
// approximate error count: 110
"PhanParamTooMany",
- // approximate error count: 63
- "PhanTypeArraySuspicious",
// approximate error count: 88
"PhanTypeInvalidDimOffset",
// approximate error count: 60
"PhanUndeclaredMethod",
// approximate error count: 752
"PhanUndeclaredProperty",
- // approximate error count: 53
- "PhanUndeclaredVariableDim",
] );
$cfg['ignore_undeclared_variables_in_global_scope'] = true;
'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;
* - '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 = [];
);
$options = Xml::listDropDownOptionsOoui( $options );
+ $fields = [];
$fields[] = new OOUI\LabelWidget( [ 'label' => new OOUI\HtmlSnippet(
$this->prepareMessage( 'filedelete-intro' ) ) ]
);
}
}
+ $like = [];
$like[] = $bits['scheme'] . $bits['delimiter'] . $bits['host'];
if ( $subdomains ) {
}
$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(),
}
$blockPage = SpecialPage::getTitleFor( 'Block', $userText );
- $moreLinkAttribs['class'] = 'mw-usertoollinks-block';
+ $moreLinkAttribs = [ 'class' => 'mw-usertoollinks-block' ];
return self::link( $blockPage,
wfMessage( 'blocklink' )->escaped(),
}
$emailPage = SpecialPage::getTitleFor( 'Emailuser', $userText );
- $moreLinkAttribs['class'] = 'mw-usertoollinks-mail';
+ $moreLinkAttribs = [ 'class' => 'mw-usertoollinks-mail' ];
return self::link( $emailPage,
wfMessage( 'emaillink' )->escaped(),
$moreLinkAttribs
if ( $wgLocalInterwiki ) {
// Hard deprecated in 1.34.
wfDeprecated( '$wgLocalInterwiki – use $wgLocalInterwikis instead', '1.23' );
+ // @phan-suppress-next-line PhanUndeclaredVariableDim
array_unshift( $wgLocalInterwikis, $wgLocalInterwiki );
}
}
$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 ) {
/**
* 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 ) {
}
list( $target, /*...*/ ) = SpecialBlock::getTargetAndType( $params['user'] );
+ $res = [];
$res['user'] = $params['user'];
$res['userID'] = $target instanceof User ? $target->getId() : 0;
$status = $ep->attemptSave( $result );
$wgRequest = $oldRequest;
+ $r = [];
switch ( $status->value ) {
case EditPage::AS_HOOK_ERROR:
case EditPage::AS_HOOK_ERROR_EXPECTED:
private $mGeneratorData = []; // [ns][dbkey] => data array
private $mFakePageId = -1;
private $mCacheMode = 'public';
+ /** @var array */
private $mRequestedPageFields = [];
/** @var int */
private $mDefaultNamespace = NS_MAIN;
}
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;
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 );
$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 );
}
$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 );
}
}
}
+ $result = [];
// No errors, no warnings: do the upload
if ( $this->mParams['async'] ) {
$progress = UploadBase::getSessionStatus( $this->getUser(), $this->mParams['filekey'] );
$form = $this->getUserRightsPage();
$form->setContext( $this->getContext() );
+ $r = [];
$r['user'] = $user->getName();
$r['userid'] = $user->getId();
list( $r['added'], $r['removed'] ) = $form->doSaveUserGroups(
$user = $this->getUser();
}
+ $r = [];
$validity = $user->checkPasswordValidity( $params['password'] );
$r['validity'] = $validity->isGood() ? 'Good' : ( $validity->isOK() ? 'Change' : 'Invalid' );
$messages = array_merge(
*
* @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();
if ( isset( $profile['desc-message'] ) ) {
$helpMessages[$profile['name']] = $profile['desc-message'];
}
+
if ( !empty( $profile['default'] ) ) {
$defaultProfile = $profile['name'];
}
* 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();
}
$options['sensitive'] = !empty( $options['sensitive'] );
- // @phan-suppress-next-line PhanTypeArraySuspiciousNullable
$type = $options['type'];
if ( !array_key_exists( $name, $merged ) ) {
/**
* 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;
/**
* Handles B/C for $wgPasswordAttemptThrottle.
* @param array $throttleConditions
- * @return array
+ * @return array[]
* @see $wgPasswordAttemptThrottle for structure
*/
protected static function normalizeThrottleConditions( $throttleConditions ) {
$block[0], $block[0]->unpatrolled, $block[0]->watched );
}
- $queryParams['curid'] = $curId;
+ $queryParams = [ 'curid' => $curId ];
# Sub-entries
$lines = [];
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'];
* @since 1.28
*/
public function getFieldsForSearchIndex( SearchEngine $engine ) {
+ $fields = [];
$fields['category'] = $engine->makeSearchFieldMapping(
'category',
SearchIndexField::INDEX_TYPE_TEXT
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 );
$this->loadFromDB( self::READ_NORMAL );
$fields = $this->getCacheFields( '' );
+ $cacheVal = [];
$cacheVal['fileExists'] = $this->fileExists;
if ( $this->fileExists ) {
foreach ( $fields as $field ) {
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;
* - 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 ) {
*
* @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 ) {
}
/**
- * @return JobQueue[]
+ * @return array[]
+ * @phan-return array<string,array{queue:JobQueue,types:array<string,class-string>}>
*/
protected function getCoalescedQueues() {
global $wgJobTypeConf;
/**
* 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;
* - max: Maximum value
* - variance: Variance (spread) of the values
*
- * @return array
+ * @return array[]
* @see getRawData()
* @see getCompleteMetrics()
*/
* 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()
*/
* 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 ) {
* - 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'] ?? [];
* - 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;
*
* @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 );
);
$options = Xml::listDropDownOptionsOoui( $options );
+ $fields = [];
$fields[] = new OOUI\FieldLayout(
new OOUI\DropdownInputWidget( [
'name' => 'wpDeleteReasonList',
if ( $this->options->get( 'EnableEmail' ) ) {
if ( $canViewPrivateInfo ) {
+ $helpMessages = [];
$helpMessages[] = $this->options->get( 'EmailConfirmToEdit' )
? 'prefs-help-email-required'
: 'prefs-help-email';
* @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;
* 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 );
/**
* 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;
$linkRenderer = $sp->getLinkRenderer();
+ $tools = [];
# No talk pages for IP ranges.
if ( !$isRange ) {
$tools['user-talk'] = $linkRenderer->makeLink(
$linkRenderer = $this->getLinkRenderer();
$link = $linkRenderer->makeLink( $title );
+ $tools = [];
$tools['talk'] = $linkRenderer->makeLink(
$title->getTalkPage(),
$this->msg( 'talkpagelinktext' )->text()
# 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 );
$out->enableOOUI();
+ $fields = [];
$fields[] = new OOUI\ActionFieldLayout(
new OOUI\TextInputWidget( [
'name' => 'prefix',
}
if ( $this->mAllowed && ( $haveRevisions || $haveFiles ) ) {
+ $fields = [];
$fields[] = new OOUI\Layout( [
'content' => new OOUI\HtmlSnippet( $this->msg( 'undeleteextrahelp' )->parseAsBlock() )
] );
$fetchlinks = ( !$hidelinks || !$hideredirs );
// Build query conds in concert for all three tables...
+ $conds = [];
$conds['pagelinks'] = [
'pl_namespace' => $target->getNamespace(),
'pl_title' => $target->getDBkey(),
// 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;
* @param string $name
* @param string $value
* @return string
- * @suppress PhanTypeArraySuspiciousNullable
+ * @suppress PhanTypeArraySuspiciousNullable,PhanTypeArraySuspicious
*/
function formatValue( $name, $value ) {
static $msg = null;
/* User preference timezone */true
) );
if ( $this->getUser()->isAllowed( 'block' ) ) {
+ $links = [];
if ( $row->ipb_auto ) {
$links[] = $linkRenderer->makeKnownLink(
SpecialPage::getTitleFor( 'Unblock' ),
* 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;
$pages = [];
$deleteUrls = [];
- if ( !empty( $childPages ) ) {
+ if ( $childPages ) {
// Load child rows by ID
$childRows = $dbr->select(
[ 'page', 'page_props', 'category' ],
}
}
- if ( !empty( $parentCats ) ) {
+ if ( $parentCats ) {
// Load parent rows by title
$joinConditions = [
'page' => [
$param = $split[1];
}
$fileURIs = explode( ';', $param );
+ $newFileURIs = [];
foreach ( $fileURIs as $URI ) {
switch ( $val ) {
case "file":
$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 ),
'STRAIGHT_JOIN' // per T58041
];
- if ( $force ) {
- $collationConds = [];
- } else {
+ $collationConds = [];
+ if ( !$force ) {
if ( $this->hasOption( 'previous-collation' ) ) {
$collationConds['cl_collation'] = $this->getOption( 'previous-collation' );
} else {
}
$json = FormatJson::decode( file_get_contents( $filename ), true );
- if ( $json === null ) {
+ if ( !is_array( $json ) ) {
$this->fatalError( "Error: Invalid JSON" );
}