Unsuppress phan issues part 6
authorDaimona Eaytoy <daimona.wiki@gmail.com>
Fri, 30 Aug 2019 18:17:32 +0000 (20:17 +0200)
committerDaimona Eaytoy <daimona.wiki@gmail.com>
Sun, 1 Sep 2019 09:48:45 +0000 (09:48 +0000)
Bug: T231636
Depends-On: I50377746f01749b058c39fd8229f9d566224cc43
Change-Id: I2cd24e73726394e3200a570c45d5e86b6849bfa9

37 files changed:
.phan/config.php
includes/GlobalFunctions.php
includes/Revision/RenderedRevision.php
includes/Revision/RevisionRenderer.php
includes/Revision/RevisionStore.php
includes/api/ApiMain.php
includes/api/ApiOpenSearch.php
includes/api/ApiQueryBacklinks.php
includes/api/ApiQueryInfo.php
includes/api/ApiQueryUserInfo.php
includes/auth/AuthenticationRequest.php
includes/changes/RecentChange.php
includes/diff/DiffEngine.php
includes/filerepo/RepoGroup.php
includes/filerepo/file/LocalFile.php
includes/historyblob/DiffHistoryBlob.php
includes/http/HttpRequestFactory.php
includes/http/MWHttpRequest.php
includes/import/WikiImporter.php
includes/libs/MappedIterator.php
includes/libs/filebackend/FileBackend.php
includes/libs/http/MultiHttpClient.php
includes/libs/objectcache/BagOStuff.php
includes/libs/objectcache/HashBagOStuff.php
includes/libs/objectcache/MediumSpecificBagOStuff.php
includes/libs/objectcache/wancache/WANObjectCache.php
includes/logging/BlockLogFormatter.php
includes/parser/Parser.php
includes/resourceloader/ResourceLoaderClientHtml.php
includes/session/SessionManager.php
includes/shell/Shell.php
includes/skins/BaseTemplate.php
includes/specials/forms/UploadForm.php
includes/widget/ComplexTitleInputWidget.php
maintenance/convertExtensionToRegistration.php
maintenance/includes/TextPassDumper.php
maintenance/storage/compressOld.php

index 6405cec..e02dba7 100644 (file)
@@ -76,18 +76,17 @@ $cfg['exclude_analysis_directory_list'] = [
 ];
 
 $cfg['suppress_issue_types'] = array_merge( $cfg['suppress_issue_types'], [
-       // approximate error count: 22
-       "PhanAccessMethodInternal",
        // approximate error count: 19
-       "PhanParamReqAfterOpt",
+       "PhanParamReqAfterOpt", // False positives with nullables, ref phan issue #3159
        // approximate error count: 110
-       "PhanParamTooMany",
-       // approximate error count: 88
-       "PhanTypeInvalidDimOffset",
-       // approximate error count: 60
-       "PhanTypeMismatchArgument",
+       "PhanParamTooMany", // False positives with variargs. Unsuppress after dropping HHVM
+
+       // approximate error count: 22
+       "PhanAccessMethodInternal",
        // approximate error count: 36
        "PhanUndeclaredConstant",
+       // approximate error count: 60
+       "PhanTypeMismatchArgument",
        // approximate error count: 219
        "PhanUndeclaredMethod",
        // approximate error count: 752
index 4ae9237..2cde173 100644 (file)
@@ -2116,6 +2116,7 @@ function wfEscapeShellArg( ...$args ) {
  *     including errors from limit.sh
  *   - profileMethod: By default this function will profile based on the calling
  *     method. Set this to a string for an alternative method to profile from
+ * @phan-param array{duplicateStderr?:bool,profileMethod?:string} $options
  *
  * @return string Collected stdout as a string
  * @deprecated since 1.30 use class MediaWiki\Shell\Shell
@@ -2134,6 +2135,7 @@ function wfShellExec( $cmd, &$retval = null, $environ = [],
        }
 
        $includeStderr = isset( $options['duplicateStderr'] ) && $options['duplicateStderr'];
+       // @phan-suppress-next-line PhanTypeInvalidDimOffset
        $profileMethod = $options['profileMethod'] ?? wfGetCaller();
 
        try {
@@ -2190,6 +2192,7 @@ function wfShellExecWithStderr( $cmd, &$retval = null, $environ = [], $limits =
  * @param array $options Associative array of options:
  *     'php': The path to the php executable
  *     'wrapper': Path to a PHP wrapper to handle the maintenance script
+ * @phan-param array{php?:string,wrapper?:string} $options
  * @return string
  */
 function wfShellWikiCmd( $script, array $parameters = [], array $options = [] ) {
@@ -2197,6 +2200,7 @@ function wfShellWikiCmd( $script, array $parameters = [], array $options = [] )
        // Give site config file a chance to run the script in a wrapper.
        // The caller may likely want to call wfBasename() on $script.
        Hooks::run( 'wfShellWikiCmd', [ &$script, &$parameters, &$options ] );
+       // @phan-suppress-next-line PhanTypeInvalidDimOffset
        $cmd = [ $options['php'] ?? $wgPhpCli ];
        if ( isset( $options['wrapper'] ) ) {
                $cmd[] = $options['wrapper'];
index 3bc8dda..ba229d1 100644 (file)
@@ -185,6 +185,7 @@ class RenderedRevision implements SlotRenderingProvider {
         * @param array $hints Hints given as an associative array. Known keys:
         *      - 'generate-html' => bool: Whether the caller is interested in output HTML (as opposed
         *        to just meta-data). Default is to generate HTML.
+        * @phan-param array{generate-html?:bool} $hints
         *
         * @return ParserOutput
         */
@@ -212,6 +213,7 @@ class RenderedRevision implements SlotRenderingProvider {
         * @param array $hints Hints given as an associative array. Known keys:
         *      - 'generate-html' => bool: Whether the caller is interested in output HTML (as opposed
         *        to just meta-data). Default is to generate HTML.
+        * @phan-param array{generate-html?:bool} $hints
         *
         * @throws SuppressedDataException if the content is not accessible for the audience
         *         specified in the constructor.
index 3c3b6a9..ea90255 100644 (file)
@@ -95,6 +95,7 @@ class RevisionRenderer {
         *        matched the $rev and $options. This mechanism is intended as a temporary stop-gap,
         *        for the time until caches have been changed to store RenderedRevision states instead
         *        of ParserOutput objects.
+        * @phan-param array{use-master?:bool,audience?:int,known-revision-output?:ParserOutput} $hints
         *
         * @return RenderedRevision|null The rendered revision, or null if the audience checks fails.
         */
@@ -108,6 +109,7 @@ class RevisionRenderer {
                        throw new InvalidArgumentException( 'Mismatching wiki ID ' . $rev->getWikiId() );
                }
 
+               // @phan-suppress-next-line PhanTypeInvalidDimOffset
                $audience = $hints['audience']
                        ?? ( $forUser ? RevisionRecord::FOR_THIS_USER : RevisionRecord::FOR_PUBLIC );
 
@@ -121,6 +123,7 @@ class RevisionRenderer {
                        $options = ParserOptions::newCanonical( $forUser ?: 'canonical' );
                }
 
+               // @phan-suppress-next-line PhanTypeInvalidDimOffset
                $useMaster = $hints['use-master'] ?? false;
 
                $dbIndex = $useMaster
index 9e8dfe7..818a536 100644 (file)
@@ -2324,6 +2324,7 @@ class RevisionStore
         *  - tables: (string[]) to include in the `$table` to `IDatabase->select()`
         *  - fields: (string[]) to include in the `$vars` to `IDatabase->select()`
         *  - joins: (array) to include in the `$join_conds` to `IDatabase->select()`
+        * @phan-return array{tables:string[],fields:string[],joins:array}
         */
        public function getQueryInfo( $options = [] ) {
                $ret = [
index 641aa9f..574d83b 100644 (file)
@@ -153,6 +153,7 @@ class ApiMain extends ApiBase {
        private $mModule;
 
        private $mCacheMode = 'private';
+       /** @var array */
        private $mCacheControl = [];
        private $mParamsUsed = [];
        private $mParamsSensitive = [];
index 6a575ec..0ba4a0e 100644 (file)
@@ -96,6 +96,7 @@ class ApiOpenSearch extends ApiBase {
                        // Trim extracts, if necessary
                        $length = $this->getConfig()->get( 'OpenSearchDescriptionLength' );
                        foreach ( $results as &$r ) {
+                               // @phan-suppress-next-line PhanTypeInvalidDimOffset
                                if ( is_string( $r['extract'] ) && !$r['extract trimmed'] ) {
                                        $r['extract'] = self::trimExtract( $r['extract'], $length );
                                }
index 0cda960..6c1eb0f 100644 (file)
@@ -35,7 +35,10 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
         */
        private $rootTitle;
 
-       private $params, $cont, $redirect;
+       private $params;
+       /** @var array */
+       private $cont;
+       private $redirect;
        private $bl_ns, $bl_from, $bl_from_ns, $bl_table, $bl_code, $bl_title, $bl_fields, $hasNS;
 
        /**
@@ -323,6 +326,7 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
        /**
         * @param ApiPageSet $resultPageSet
         * @return void
+        * @suppress PhanTypeInvalidDimOffset
         */
        private function run( $resultPageSet = null ) {
                $this->params = $this->extractRequestParams( false );
index ac7e5cc..98474c7 100644 (file)
@@ -118,6 +118,7 @@ class ApiQueryInfo extends ApiQueryBase {
                return $this->tokenFunctions;
        }
 
+       /** @var string[] */
        protected static $cachedTokens = [];
 
        /**
index ab8d93a..12d7435 100644 (file)
@@ -34,7 +34,9 @@ class ApiQueryUserInfo extends ApiQueryBase {
 
        const WL_UNREAD_LIMIT = 1000;
 
+       /** @var array */
        private $params = [];
+       /** @var array */
        private $prop = [];
 
        public function __construct( ApiQuery $query, $moduleName ) {
index 74ce60a..1a2442c 100644 (file)
@@ -298,6 +298,7 @@ abstract class AuthenticationRequest {
         * @param AuthenticationRequest[] $reqs
         * @return array
         * @throws \UnexpectedValueException If fields cannot be merged
+        * @suppress PhanTypeInvalidDimOffset
         */
        public static function mergeFieldInfo( array $reqs ) {
                $merged = [];
index edaa963..1d590d9 100644 (file)
@@ -90,6 +90,7 @@ class RecentChange implements Taggable {
         */
        const SEND_FEED = false;
 
+       /** @var array */
        public $mAttribs = [];
        public $mExtra = [];
 
index ce507d7..6ebec1c 100644 (file)
@@ -47,7 +47,9 @@ use MediaWiki\Diff\ComplexityException;
 class DiffEngine {
 
        // Input variables
+       /** @var string[] */
        private $from;
+       /** @var string[] */
        private $to;
        private $m;
        private $n;
@@ -361,6 +363,7 @@ class DiffEngine {
                         */
                        $max = min( $this->m, $this->n );
                        for ( $forwardBound = 0; $forwardBound < $max
+                               // @phan-suppress-next-line PhanTypeInvalidDimOffset
                                && $this->from[$forwardBound] === $this->to[$forwardBound];
                                ++$forwardBound
                        ) {
index e474ad3..96df29f 100644 (file)
@@ -115,6 +115,8 @@ class RepoGroup {
         *                   user is allowed to view them. Otherwise, such files will not
         *                   be found.
         *   latest:         If true, load from the latest available data into File objects
+        * @phan-param array{time?:mixed,ignoreRedirect?:bool,private?:bool,latest?:bool} $options
+        * @suppress PhanTypeInvalidDimOffset
         * @return File|bool False if title is not found
         */
        function findFile( $title, $options = [] ) {
index 2890360..cd789d9 100644 (file)
@@ -1080,6 +1080,7 @@ class LocalFile extends File {
        /**
         * Delete cached transformed files for the current version only.
         * @param array $options
+        * @phan-param array{forThumbRefresh?:bool} $options
         */
        public function purgeThumbnails( $options = [] ) {
                $files = $this->getThumbnails();
@@ -1091,6 +1092,7 @@ class LocalFile extends File {
                array_shift( $urls ); // don't purge directory
 
                // Give media handler a chance to filter the file purge list
+               // @phan-suppress-next-line PhanTypeInvalidDimOffset
                if ( !empty( $options['forThumbRefresh'] ) ) {
                        $handler = $this->getHandler();
                        if ( $handler ) {
index fdb3dc4..5173916 100644 (file)
@@ -155,14 +155,13 @@ class DiffHistoryBlob implements HistoryBlob {
                                        $seqName = 'main';
                                }
                        }
-                       $seq =& $sequences[$seqName];
-                       $tail = $seq['tail'];
+
+                       $tail = $sequences[$seqName]['tail'];
                        $diff = $this->diff( $tail, $text );
-                       $seq['diffs'][] = $diff;
-                       $seq['map'][] = $i;
-                       $seq['tail'] = $text;
+                       $sequences[$seqName]['diffs'][] = $diff;
+                       $sequences[$seqName]['map'][] = $i;
+                       $sequences[$seqName]['tail'] = $text;
                }
-               unset( $seq ); // unlink dangerous alias
 
                // Knit the sequences together
                $tail = '';
index 8e5567b..8433df6 100644 (file)
@@ -58,10 +58,14 @@ class HttpRequestFactory {
         *    - password            Password for HTTP Basic Authentication
         *    - originalRequest     Information about the original request (as a WebRequest object or
         *                          an associative array with 'ip' and 'userAgent').
+        * @codingStandardsIgnoreStart
+        * @phan-param array{timeout?:int,connectTimeout?:int,postData?:array,proxy?:string,noProxy?:bool,sslVerifyHost?:bool,sslVerifyCert?:bool,caInfo?:string,maxRedirects?:int,followRedirects?:bool,userAgent?:string,logger?:\Psr\Logger\LoggerInterface,username?:string,password?:string,originalRequest?:WebRequest|array{ip:string,userAgent:string}} $options
+        * @codingStandardsIgnoreEnd
         * @param string $caller The method making this request, for profiling
         * @throws RuntimeException
         * @return MWHttpRequest
         * @see MWHttpRequest::__construct
+        * @suppress PhanUndeclaredTypeParameter
         */
        public function create( $url, array $options = [], $caller = __METHOD__ ) {
                if ( !Http::$httpEngine ) {
index 41ea1dc..3a2f982 100644 (file)
@@ -46,6 +46,7 @@ abstract class MWHttpRequest implements LoggerAwareInterface {
        protected $sslVerifyCert = true;
        protected $caInfo = null;
        protected $method = "GET";
+       /** @var array */
        protected $reqHeaders = [];
        protected $url;
        protected $parsedUrl;
@@ -63,6 +64,7 @@ abstract class MWHttpRequest implements LoggerAwareInterface {
        protected $headerList = [];
        protected $respVersion = "0.9";
        protected $respStatus = "200 Ok";
+       /** @var string[][] */
        protected $respHeaders = [];
 
        /** @var StatusValue */
@@ -86,6 +88,9 @@ abstract class MWHttpRequest implements LoggerAwareInterface {
        /**
         * @param string $url Url to use. If protocol-relative, will be expanded to an http:// URL
         * @param array $options (optional) extra params to pass (see HttpRequestFactory::create())
+        * @codingStandardsIgnoreStart
+        * @phan-param array{timeout?:int,connectTimeout?:int,postData?:array,proxy?:string,noProxy?:bool,sslVerifyHost?:bool,sslVerifyCert?:bool,caInfo?:string,maxRedirects?:int,followRedirects?:bool,userAgent?:string,logger?:LoggerInterface,username?:string,password?:string,originalRequest?:WebRequest|array{ip:string,userAgent:string},method?:string} $options
+        * @codingStandardsIgnoreEnd
         * @param string $caller The method making this request, for profiling
         * @param Profiler|null $profiler An instance of the profiler for profiling, or null
         * @throws Exception
@@ -98,6 +103,7 @@ abstract class MWHttpRequest implements LoggerAwareInterface {
                $this->url = wfExpandUrl( $url, PROTO_HTTP );
                $this->parsedUrl = wfParseUrl( $this->url );
 
+               // @phan-suppress-next-line PhanTypeInvalidDimOffset
                $this->logger = $options['logger'] ?? new NullLogger();
 
                if ( !$this->parsedUrl || !Http::isValidURI( $this->url ) ) {
@@ -139,6 +145,7 @@ abstract class MWHttpRequest implements LoggerAwareInterface {
                                // ensure that MWHttpRequest::method is always
                                // uppercased. T38137
                                if ( $o == 'method' ) {
+                                       // @phan-suppress-next-line PhanTypeInvalidDimOffset
                                        $options[$o] = strtoupper( $options[$o] );
                                }
                                $this->$o = $options[$o];
index 68f5b9b..0d1cc68 100644 (file)
@@ -738,6 +738,9 @@ class WikiImporter {
                return $this->logItemCallback( $revision );
        }
 
+       /**
+        * @suppress PhanTypeInvalidDimOffset Phan not reading the reference inside the hook
+        */
        private function handlePage() {
                // Handle page data.
                $this->debug( "Enter page handler." );
index 4a62e72..9d53a86 100644 (file)
@@ -45,9 +45,10 @@ class MappedIterator extends FilterIterator {
         * the base iterator (post-callback) and will return true if that value should be
         * included in iteration of the MappedIterator (otherwise it will be filtered out).
         *
-        * @param Iterator|Array $iter
+        * @param Iterator|array $iter
         * @param callable $vCallback Value transformation callback
         * @param array $options Options map (includes "accept") (since 1.22)
+        * @phan-param array{accept?:callable} $options
         * @throws UnexpectedValueException
         */
        public function __construct( $iter, $vCallback, array $options = [] ) {
@@ -60,6 +61,7 @@ class MappedIterator extends FilterIterator {
                }
                parent::__construct( $baseIterator );
                $this->vCallback = $vCallback;
+               // @phan-suppress-next-line PhanTypeInvalidDimOffset
                $this->aCallback = $options['accept'] ?? null;
        }
 
index 905e925..428fec6 100644 (file)
@@ -428,7 +428,11 @@ abstract class FileBackend implements LoggerAwareInterface {
         *   - b) predicted operation errors occurred and 'force' was not set
         *
         * @param array $ops List of operations to execute in order
+        * @codingStandardsIgnoreStart
+        * @phan-param array{ignoreMissingSource?:bool,overwrite?:bool,overwriteSame?:bool,headers?:bool} $ops
         * @param array $opts Batch operation options
+        * @phan-param array{force?:bool,nonLocking?:bool,nonJournaled?:bool,parallelize?:bool,bypassReadOnly?:bool,preserveCache?:bool} $opts
+        * @codingStandardsIgnoreEnd
         * @return StatusValue
         */
        final public function doOperations( array $ops, array $opts = [] ) {
@@ -666,7 +670,9 @@ abstract class FileBackend implements LoggerAwareInterface {
         * considered "OK" as long as no fatal errors occurred.
         *
         * @param array $ops Set of operations to execute
+        * @phan-param array{ignoreMissingSource?:bool,headers?:bool} $ops
         * @param array $opts Batch operation options
+        * @phan-param array{bypassReadOnly?:bool} $opts
         * @return StatusValue
         * @since 1.20
         */
index 5e233ae..6b1ef89 100644 (file)
@@ -188,8 +188,12 @@ class MultiHttpClient implements LoggerAwareInterface {
         *   - reqTimeout      : post-connection timeout per request (seconds)
         *   - usePipelining   : whether to use HTTP pipelining if possible
         *   - maxConnsPerHost : maximum number of concurrent connections (per host)
+        * @codingStandardsIgnoreStart
+        * @phan-param array{connTimeout?:int,reqTimeout?:int,usePipelining?:bool,maxConnsPerHost?:int} $opts
+        * @codingStandardsIgnoreEnd
         * @return array $reqs With response array populated for each
         * @throws Exception
+        * @suppress PhanTypeInvalidDimOffset
         */
        private function runMultiCurl( array $reqs, array $opts = [] ) {
                $chm = $this->getCurlMulti();
@@ -400,6 +404,7 @@ class MultiHttpClient implements LoggerAwareInterface {
                                $name = strtolower( $name );
                                $value = trim( $value );
                                if ( isset( $req['response']['headers'][$name] ) ) {
+                                       // @phan-suppress-next-line PhanTypeInvalidDimOffset
                                        $req['response']['headers'][$name] .= ', ' . $value;
                                } else {
                                        $req['response']['headers'][$name] = $value;
@@ -508,6 +513,7 @@ class MultiHttpClient implements LoggerAwareInterface {
                                        if ( isset( $svErrors[0]['params'][0] ) ) {
                                                if ( is_numeric( $svErrors[0]['params'][0] ) ) {
                                                        if ( isset( $svErrors[0]['params'][1] ) ) {
+                                                               // @phan-suppress-next-line PhanTypeInvalidDimOffset
                                                                $req['response']['reason'] = $svErrors[0]['params'][1];
                                                        }
                                                } else {
index 42da5f0..ad3f681 100644 (file)
@@ -91,6 +91,7 @@ abstract class BagOStuff implements IExpiringStore, IStoreKeyEncoder, LoggerAwar
         *   - asyncHandler: Callable to use for scheduling tasks after the web request ends.
         *      In CLI mode, it should run the task immediately.
         * @param array $params
+        * @phan-param array{logger?:Psr\Log\LoggerInterface,asyncHandler?:callable} $params
         */
        public function __construct( array $params = [] ) {
                $this->setLogger( $params['logger'] ?? new NullLogger() );
index 6d0940b..0f7011d 100644 (file)
@@ -47,6 +47,10 @@ class HashBagOStuff extends MediumSpecificBagOStuff {
        /**
         * @param array $params Additional parameters include:
         *   - maxKeys : only allow this many keys (using oldest-first eviction)
+        * @codingStandardsIgnoreStart
+        * @phan-param array{logger?:Psr\Log\LoggerInterface,asyncHandler?:callable,keyspace?:string,reportDupes?:bool,syncTimeout?:int,segmentationSize?:int,segmentedValueMaxSize?:int,maxKeys?:int} $params
+        * @codingStandardsIgnoreEnd
+        * @suppress PhanTypeInvalidDimOffset
         */
        function __construct( $params = [] ) {
                $params['segmentationSize'] = $params['segmentationSize'] ?? INF;
index 9d36187..252c089 100644 (file)
@@ -73,6 +73,9 @@ abstract class MediumSpecificBagOStuff extends BagOStuff {
         *      This should be configured to a reasonable size give the site traffic and the
         *      amount of I/O between application and cache servers that the network can handle.
         * @param array $params
+        * @codingStandardsIgnoreStart
+        * @phan-param array{logger?:Psr\Log\LoggerInterface,asyncHandler?:callable,keyspace?:string,reportDupes?:bool,syncTimeout?:int,segmentationSize?:int,segmentedValueMaxSize?:int} $params
+        * @codingStandardsIgnoreEnd
         */
        public function __construct( array $params = [] ) {
                parent::__construct( $params );
index 3321254..2ce216d 100644 (file)
@@ -578,10 +578,14 @@ class WANObjectCache implements IExpiringStore, IStoreKeyEncoder, LoggerAwareInt
         *   - version: Integer version number signifiying the format of the value.
         *      Default: null
         *   - walltime: How long the value took to generate in seconds. Default: 0.0
+        * @codingStandardsIgnoreStart
+        * @phan-param array{lag?:int,since?:int,pending?:bool,lockTSE?:int,staleTTL?:int,creating?:bool,version?:?string,walltime?:int|float} $opts
+        * @codingStandardsIgnoreEnd
         * @note Options added in 1.28: staleTTL
         * @note Options added in 1.33: creating
         * @note Options added in 1.34: version, walltime
         * @return bool Success
+        * @suppress PhanTypeInvalidDimOffset
         */
        final public function set( $key, $value, $ttl = self::TTL_INDEFINITE, array $opts = [] ) {
                $now = $this->getCurrentTime();
@@ -1246,11 +1250,15 @@ class WANObjectCache implements IExpiringStore, IStoreKeyEncoder, LoggerAwareInt
         *      most sense for values that are moderately to highly expensive to regenerate and easy
         *      to query for dependency timestamps. The use of "pcTTL" reduces timestamp queries.
         *      Default: null.
+        * @codingStandardsIgnoreStart
+        * @phan-param array{checkKeys?:string[],graceTTL?:int,lockTSE?:int,busyValue?:mixed,pcTTL?:int,pcGroup?:string,version?:int,minAsOf?:int,hotTTR?:int,lowTTL?:int,ageNew?:int,staleTTL?:int,touchedCallback?:callable} $opts
+        * @codingStandardsIgnoreEnd
         * @return mixed Value found or written to the key
         * @note Options added in 1.28: version, busyValue, hotTTR, ageNew, pcGroup, minAsOf
         * @note Options added in 1.31: staleTTL, graceTTL
         * @note Options added in 1.33: touchedCallback
         * @note Callable type hints are not used to avoid class-autoloading
+        * @suppress PhanTypeInvalidDimOffset
         */
        final public function getWithSetCallback( $key, $ttl, $callback, array $opts = [] ) {
                $version = $opts['version'] ?? null;
@@ -1442,6 +1450,7 @@ class WANObjectCache implements IExpiringStore, IStoreKeyEncoder, LoggerAwareInt
                                $this->setInterimValue( $key, $value, $lockTSE, $version, $walltime );
                        } else {
                                $finalSetOpts = [
+                                       // @phan-suppress-next-line PhanTypeInvalidDimOffset
                                        'since' => $setOpts['since'] ?? $preCallbackTime,
                                        'version' => $version,
                                        'staleTTL' => $staleTTL,
index ead290f..d27643c 100644 (file)
@@ -262,6 +262,10 @@ class BlockLogFormatter extends LogFormatter {
                return $params;
        }
 
+       /**
+        * @inheritDoc
+        * @suppress PhanTypeInvalidDimOffset
+        */
        public function formatParametersForApi() {
                $ret = parent::formatParametersForApi();
                if ( isset( $ret['flags'] ) ) {
index 267402f..962313e 100644 (file)
@@ -4271,6 +4271,7 @@ class Parser {
         * @param bool $isMain
         * @return mixed|string
         * @private
+        * @suppress PhanTypeInvalidDimOffset
         */
        public function formatHeadings( $text, $origText, $isMain = true ) {
                # Inhibit editsection links if requested in the page
@@ -5577,6 +5578,7 @@ class Parser {
                Hooks::run( 'ParserMakeImageParams', [ $title, $file, &$params, $this ] );
 
                # Linker does the rest
+               // @phan-suppress-next-line PhanTypeInvalidDimOffset
                $time = $options['time'] ?? false;
                $ret = Linker::makeImageLink( $this, $title, $file, $params['frame'], $params['handler'],
                        $time, $descQuery, $this->mOptions->getThumbSize() );
index e17b393..e5a0d61 100644 (file)
@@ -424,6 +424,7 @@ JAVASCRIPT;
                                $idx = -1;
                                foreach ( $grpModules as $name => $module ) {
                                        $shouldEmbed = $module->shouldEmbedModule( $context );
+                                       // @phan-suppress-next-line PhanTypeInvalidDimOffset
                                        if ( !$moduleSets || $moduleSets[$idx][0] !== $shouldEmbed ) {
                                                $moduleSets[++$idx] = [ $shouldEmbed, [] ];
                                        }
index 85f4569..fc117a8 100644 (file)
@@ -287,6 +287,7 @@ final class SessionManager implements SessionManagerInterface {
                                        "$provider returned empty session info with id flagged unsafe"
                                );
                        }
+                       // @phan-suppress-next-line PhanTypeInvalidDimOffset
                        $compare = $infos ? SessionInfo::compare( $infos[0], $info ) : -1;
                        if ( $compare > 0 ) {
                                continue;
index 19fa1da..74d77a8 100644 (file)
@@ -230,6 +230,7 @@ class Shell {
         * @param array $options Associative array of options:
         *     'php': The path to the php executable
         *     'wrapper': Path to a PHP wrapper to handle the maintenance script
+        * @phan-param array{php?:string,wrapper?:string} $options
         * @return Command
         */
        public static function makeScriptCommand( $script, $parameters, $options = [] ): Command {
@@ -237,6 +238,7 @@ class Shell {
                // Give site config file a chance to run the script in a wrapper.
                // The caller may likely want to call wfBasename() on $script.
                Hooks::run( 'wfShellWikiCmd', [ &$script, &$parameters, &$options ] );
+               // @phan-suppress-next-line PhanTypeInvalidDimOffset
                $cmd = [ $options['php'] ?? $wgPhpCli ];
                if ( isset( $options['wrapper'] ) ) {
                        $cmd[] = $options['wrapper'];
index 09e439b..bee4aff 100644 (file)
@@ -444,8 +444,10 @@ abstract class BaseTemplate extends QuickTemplate {
         * @param array $item Array of list item data containing some of a specific set of keys.
         * The "id", "class" and "itemtitle" keys will be used as attributes for the list item,
         * if "active" contains a value of true a "active" class will also be appended to class.
+        * @phan-param array{id?:string,class?:string,itemtitle?:string,active?:bool} $item
         *
         * @param array $options
+        * @phan-param array{tag?:string} $options
         *
         * If you want something other than a "<li>" you can pass a tag name such as
         * "tag" => "span" in the $options array to change the tag used.
@@ -514,6 +516,7 @@ abstract class BaseTemplate extends QuickTemplate {
                if ( isset( $item['itemtitle'] ) ) {
                        $attrs['title'] = $item['itemtitle'];
                }
+               // @phan-suppress-next-line PhanTypeInvalidDimOffset
                return Html::rawElement( $options['tag'] ?? 'li', $attrs, $html );
        }
 
index be28417..1e5f816 100644 (file)
@@ -40,6 +40,7 @@ class UploadForm extends HTMLForm {
 
        protected $mMaxFileSize = [];
 
+       /** @var array */
        protected $mMaxUploadSize = [];
 
        public function __construct( array $options = [], IContextSource $context = null,
index 392e46d..7737067 100644 (file)
@@ -20,6 +20,7 @@ class ComplexTitleInputWidget extends \OOUI\Widget {
         *   - array $config['namespace'] Configuration for the NamespaceInputWidget dropdown
         *     with list of namespaces
         *   - array $config['title'] Configuration for the TitleInputWidget text field
+        * @phan-param array{namespace?:array,title?:array} $config
         */
        public function __construct( array $config = [] ) {
                // Configuration initialization
index b0ac638..737e65f 100644 (file)
@@ -276,6 +276,11 @@ class ConvertExtensionToRegistration extends Maintenance {
                $this->json[$realName] = $value;
        }
 
+       /**
+        * @param string $realName
+        * @param array[] $value
+        * @suppress PhanTypeInvalidDimOffset
+        */
        protected function handleResourceModules( $realName, $value ) {
                $defaults = [];
                $remote = $this->hasOption( 'skin' ) ? 'remoteSkinPath' : 'remoteExtPath';
index d473486..00d7c90 100644 (file)
@@ -97,6 +97,7 @@ class TextPassDumper extends BackupDumper {
        protected $firstPageWritten = false;
        protected $lastPageWritten = false;
        protected $checkpointJustWritten = false;
+       /** @var string[] */
        protected $checkpointFiles = [];
 
        /**
index beb1975..b6aa626 100644 (file)
@@ -223,6 +223,7 @@ class CompressOld extends Maintenance {
         * @param string $extdb
         * @param bool|int $maxPageId
         * @return bool
+        * @suppress PhanTypeInvalidDimOffset
         */
        private function compressWithConcat( $startId, $maxChunkSize, $beginDate,
                $endDate, $extdb = "", $maxPageId = false