Merge "Localisation updates from https://translatewiki.net."
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 5 Apr 2019 23:46:19 +0000 (23:46 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 5 Apr 2019 23:46:19 +0000 (23:46 +0000)
58 files changed:
.phan/config.php
composer.json
includes/Revision/RevisionStore.php
includes/Title.php
includes/actions/McrUndoAction.php
includes/api/ApiBase.php
includes/api/ApiContinuationManager.php
includes/auth/AuthenticationRequest.php
includes/block/BlockRestriction.php
includes/block/Restriction/AbstractRestriction.php
includes/editpage/TextConflictHelper.php
includes/filebackend/lockmanager/LockManagerGroup.php
includes/filerepo/file/File.php
includes/filerepo/file/ForeignAPIFile.php
includes/filerepo/file/ForeignDBFile.php
includes/filerepo/file/LocalFile.php
includes/htmlform/OOUIHTMLForm.php
includes/import/UploadSourceAdapter.php
includes/installer/MssqlUpdater.php
includes/installer/PostgresUpdater.php
includes/installer/WebInstallerComplete.php
includes/installer/WebInstallerDocument.php
includes/jobqueue/Job.php
includes/jobqueue/jobs/ClearWatchlistNotificationsJob.php
includes/libs/mime/MimeAnalyzer.php
includes/libs/mime/XmlTypeCheck.php
includes/libs/objectcache/MemcachedClient.php
includes/libs/objectcache/MemcachedPeclBagOStuff.php
includes/libs/rdbms/ChronologyProtector.php
includes/libs/rdbms/database/Database.php
includes/libs/rdbms/database/IDatabase.php
includes/libs/rdbms/encasing/MssqlBlob.php
includes/libs/rdbms/lbfactory/ILBFactory.php
includes/libs/rdbms/loadbalancer/ILoadBalancer.php
includes/page/ImagePage.php
includes/page/WikiPage.php
includes/profiler/ProfilerStub.php
includes/rcfeed/UDPRCFeedEngine.php
includes/resourceloader/ResourceLoader.php
includes/search/NullIndexField.php
includes/specialpage/AuthManagerSpecialPage.php
includes/specialpage/ChangesListSpecialPage.php
includes/specialpage/ImageQueryPage.php
includes/specials/SpecialBlock.php
includes/specials/SpecialComparePages.php
includes/specials/SpecialEmailuser.php
includes/specials/SpecialExpandTemplates.php
includes/specials/SpecialMIMEsearch.php
includes/specials/SpecialPageLanguage.php
includes/specials/SpecialUndelete.php
includes/specials/forms/UploadForm.php
includes/specials/pagers/NewFilesPager.php
includes/utils/BatchRowUpdate.php
languages/LanguageConverter.php
maintenance/populatePPSortKey.php
maintenance/preprocessorFuzzTest.php
maintenance/storage/recompressTracked.php
tests/phpunit/MediaWikiTestCase.php

index e4ba47f..8b9aae7 100644 (file)
@@ -81,33 +81,19 @@ $cfg['suppress_issue_types'] = array_merge( $cfg['suppress_issue_types'], [
        "PhanCommentParamWithoutRealParam",
        // approximate error count: 2
        "PhanCompatibleNegativeStringOffset",
-       // approximate error count: 1
-       "PhanEmptyFQSENInCallable",
-       // approximate error count: 1
-       "PhanInvalidCommentForDeclarationType",
-       // approximate error count: 6
-       "PhanNonClassMethodCall",
        // approximate error count: 21
        "PhanParamReqAfterOpt",
-       // approximate error count: 27
+       // approximate error count: 26
        "PhanParamSignatureMismatch",
        // approximate error count: 4
        "PhanParamSignatureMismatchInternal",
-       // approximate error count: 1
-       "PhanParamSignatureRealMismatchTooFewParameters",
-       // approximate error count: 1
-       "PhanParamSuspiciousOrder",
        // approximate error count: 127
        "PhanParamTooMany",
        // approximate error count: 2
-       "PhanParamTooManyCallable",
-       // approximate error count: 1
-       "PhanParamTooManyInternal",
-       // approximate error count: 2
        "PhanPluginDuplicateExpressionBinaryOp",
        // approximate error count: 2
        "PhanTraitParentReference",
-       // approximate error count: 27
+       // approximate error count: 26
        "PhanTypeArraySuspicious",
        // approximate error count: 33
        "PhanTypeArraySuspiciousNullable",
@@ -115,54 +101,36 @@ $cfg['suppress_issue_types'] = array_merge( $cfg['suppress_issue_types'], [
        "PhanTypeComparisonFromArray",
        // approximate error count: 2
        "PhanTypeComparisonToArray",
-       // approximate error count: 1
-       "PhanTypeConversionFromArray",
        // approximate error count: 2
        "PhanTypeExpectedObjectOrClassName",
        // approximate error count: 7
        "PhanTypeExpectedObjectPropAccess",
-       // approximate error count: 3
-       "PhanTypeInstantiateAbstract",
-       // approximate error count: 1
-       "PhanTypeInvalidCallableArraySize",
        // approximate error count: 62
        "PhanTypeInvalidDimOffset",
        // approximate error count: 10
        "PhanTypeInvalidExpressionArrayDestructuring",
-       // approximate error count: 1
-       "PhanTypeInvalidLeftOperand",
        // approximate error count: 7
        "PhanTypeInvalidLeftOperandOfIntegerOp",
        // approximate error count: 2
        "PhanTypeInvalidRightOperand",
        // approximate error count: 2
        "PhanTypeInvalidRightOperandOfIntegerOp",
-       // approximate error count: 1
-       "PhanTypeMagicVoidWithReturn",
        // approximate error count: 152
        "PhanTypeMismatchArgument",
-       // approximate error count: 28
+       // approximate error count: 27
        "PhanTypeMismatchArgumentInternal",
        // approximate error count: 1
        "PhanTypeMismatchBitwiseBinaryOperands",
-       // approximate error count: 1
-       "PhanTypeMismatchDeclaredParam",
        // approximate error count: 2
        "PhanTypeMismatchDimEmpty",
        // approximate error count: 29
        "PhanTypeMismatchDimFetch",
        // approximate error count: 10
        "PhanTypeMismatchForeach",
-       // approximate error count: 77
+       // approximate error count: 78
        "PhanTypeMismatchProperty",
-       // approximate error count: 88
+       // approximate error count: 85
        "PhanTypeMismatchReturn",
-       // approximate error count: 43
-       "PhanTypeMissingReturn",
-       // approximate error count: 1
-       "PhanTypeNoAccessiblePropertiesForeach",
-       // approximate error count: 4
-       "PhanTypeNonVarPassByRef",
        // approximate error count: 12
        "PhanTypeObjectUnsetDeclaredProperty",
        // approximate error count: 9
@@ -173,19 +141,15 @@ $cfg['suppress_issue_types'] = array_merge( $cfg['suppress_issue_types'], [
        "PhanUndeclaredConstant",
        // approximate error count: 3
        "PhanUndeclaredInvokeInCallable",
-       // approximate error count: 242
+       // approximate error count: 239
        "PhanUndeclaredMethod",
        // approximate error count: 847
        "PhanUndeclaredProperty",
-       // approximate error count: 1
-       "PhanUndeclaredTypeReturnType",
-       // approximate error count: 3
-       "PhanUndeclaredTypeThrowsType",
        // approximate error count: 2
        "PhanUndeclaredVariableAssignOp",
        // approximate error count: 55
        "PhanUndeclaredVariableDim",
-       // approximate error count: 4
+       // approximate error count: 3
        "PhanUnextractableAnnotationElementName",
        // approximate error count: 4
        "PhanUnextractableAnnotationSuffix",
index 3faf620..b6814c5 100644 (file)
@@ -65,7 +65,7 @@
                "jakub-onderka/php-console-highlighter": "0.3.2",
                "jakub-onderka/php-parallel-lint": "0.9.2",
                "justinrainbow/json-schema": "~5.2",
-               "mediawiki/mediawiki-codesniffer": "24.0.0",
+               "mediawiki/mediawiki-codesniffer": "25.0.0",
                "monolog/monolog": "~1.22.1",
                "nikic/php-parser": "3.1.5",
                "seld/jsonlint": "1.7.1",
index 2a54a9b..0329bd1 100644 (file)
@@ -1670,6 +1670,7 @@ class RevisionStore
        ) {
                if ( !$this->hasMcrSchemaFlags( SCHEMA_COMPAT_READ_NEW ) ) {
                        $mainSlot = $this->emulateMainSlot_1_29( $revisionRow, $queryFlags, $title );
+                       // @phan-suppress-next-line PhanTypeInvalidCallableArraySize false positive
                        $slots = new RevisionSlots( [ SlotRecord::MAIN => $mainSlot ] );
                } else {
                        // XXX: do we need the same kind of caching here
index d517b85..3d54750 100644 (file)
@@ -731,6 +731,7 @@ class Title implements LinkTarget, IDBAccessObject {
                                // Allow unicode if a single high-bit character appears
                                $r0 = sprintf( '\x%02x', $ord0 );
                                $allowUnicode = true;
+                               // @phan-suppress-next-line PhanParamSuspiciousOrder false positive
                        } elseif ( strpos( '-\\[]^', $d0 ) !== false ) {
                                $r0 = '\\' . $d0;
                        } else {
index b0f89dc..e9de846 100644 (file)
@@ -30,7 +30,7 @@ class McrUndoAction extends FormAction {
 
        protected $undo = 0, $undoafter = 0, $cur = 0;
 
-       /** @param RevisionRecord|null */
+       /** @var RevisionRecord|null */
        protected $curRev = null;
 
        public function getName() {
index 9b3d116..528ced8 100644 (file)
@@ -800,6 +800,7 @@ abstract class ApiBase extends ContextSource {
                                        // $results if all are done.
                                        unset( $targets[$placeholder] );
                                        $placeholder = '{' . $placeholder . '}';
+                                       // @phan-suppress-next-line PhanTypeNoAccessiblePropertiesForeach
                                        foreach ( $results[$target] as $value ) {
                                                if ( !preg_match( '/^[^{}]*$/', $value ) ) {
                                                        // Skip values that make invalid parameter names.
index 7da8ed9..e4c52dd 100644 (file)
@@ -217,6 +217,8 @@ class ApiContinuationManager {
                        // Some modules are unfinished: include those params, and copy
                        // the generator params.
                        foreach ( $continuationData as $module => $kvp ) {
+                               // XXX: Not sure why phan is complaining here...
+                               // @phan-suppress-next-line PhanTypeInvalidLeftOperand
                                $data += $kvp;
                        }
                        $generatorParams = [];
index 7fc362a..4744c4d 100644 (file)
@@ -370,6 +370,7 @@ abstract class AuthenticationRequest {
         * @return AuthenticationRequest
         */
        public static function __set_state( $data ) {
+               // @phan-suppress-next-line PhanTypeInstantiateAbstract
                $ret = new static();
                foreach ( $data as $k => $v ) {
                        $ret->$k = $v;
index cbd30c2..2e8752e 100644 (file)
@@ -25,6 +25,7 @@ namespace MediaWiki\Block;
 use MediaWiki\Block\Restriction\NamespaceRestriction;
 use MediaWiki\Block\Restriction\PageRestriction;
 use MediaWiki\Block\Restriction\Restriction;
+use MWException;
 use Wikimedia\Rdbms\IResultWrapper;
 use Wikimedia\Rdbms\IDatabase;
 
index 20678ad..7970266 100644 (file)
@@ -97,6 +97,7 @@ abstract class AbstractRestriction implements Restriction {
         * @inheritDoc
         */
        public static function newFromRow( \stdClass $row ) {
+               // @phan-suppress-next-line PhanTypeInstantiateAbstract
                return new static( $row->ir_ipb_id, $row->ir_value );
        }
 
index f7d0945..2471b52 100644 (file)
@@ -166,7 +166,6 @@ class TextConflictHelper {
         * HTML to build the textbox1 on edit conflicts
         *
         * @param array $customAttribs
-        * @return string HTML
         */
        public function getEditConflictMainTextBox( array $customAttribs = [] ) {
                $builder = new TextboxBuilder();
index aa955d0..43f6010 100644 (file)
@@ -129,6 +129,7 @@ class LockManagerGroup {
                        }
                        $config['logger'] = LoggerFactory::getInstance( 'LockManager' );
 
+                       // @phan-suppress-next-line PhanTypeInstantiateAbstract
                        $this->managers[$name]['instance'] = new $class( $config );
                }
 
index 97abe33..7d4f4df 100644 (file)
@@ -29,6 +29,7 @@ use MediaWiki\MediaWikiServices;
  * @ingroup FileAbstraction
  */
 
+// @phan-file-suppress PhanTypeMissingReturn false positives
 /**
  * Implements some public methods and some protected utility functions which
  * are required by multiple child classes. Contains stub functionality for
index 3a75720..ab8ef2f 100644 (file)
@@ -154,7 +154,7 @@ class ForeignAPIFile extends File {
 
        /**
         * @param int $page
-        * @return int|number
+        * @return int
         */
        public function getWidth( $page = 1 ) {
                return isset( $this->mInfo['width'] ) ? intval( $this->mInfo['width'] ) : 0;
index 1869967..3438a63 100644 (file)
@@ -24,6 +24,7 @@
 use MediaWiki\MediaWikiServices;
 use Wikimedia\Rdbms\DBUnexpectedError;
 
+// @phan-file-suppress PhanTypeMissingReturn false positives
 /**
  * Foreign file with an accessible MediaWiki database
  *
index 134a104..aa04fae 100644 (file)
@@ -796,11 +796,14 @@ class LocalFile extends File {
        /** isVisible inherited */
 
        /**
+        * Checks if this file exists in its parent repo, as referenced by its
+        * virtual URL.
+        *
         * @return bool
         */
        function isMissing() {
                if ( $this->missing === null ) {
-                       list( $fileExists ) = $this->repo->fileExists( $this->getVirtualUrl() );
+                       $fileExists = $this->repo->fileExists( $this->getVirtualUrl() );
                        $this->missing = !$fileExists;
                }
 
index 738db09..e21d783 100644 (file)
@@ -145,6 +145,10 @@ class OOUIHTMLForm extends HTMLForm {
                        [ 'class' => 'mw-htmlform-submit-buttons' ], "\n$buttons" ) . "\n";
        }
 
+       /**
+        * @inheritDoc
+        * @return OOUI\PanelLayout
+        */
        protected function wrapFieldSetSection( $legend, $section, $attributes, $isRoot ) {
                // to get a user visible effect, wrap the fieldset into a framed panel layout
                $layout = new OOUI\PanelLayout( [
index ccacbe4..7ac895c 100644 (file)
@@ -32,7 +32,7 @@ class UploadSourceAdapter {
        /** @var array */
        public static $sourceRegistrations = [];
 
-       /** @var string */
+       /** @var ImportSource */
        private $mSource;
 
        /** @var string */
index 75f3894..b8dc5ff 100644 (file)
@@ -166,6 +166,7 @@ class MssqlUpdater extends DatabaseUpdater {
                parent::applyPatch( $path, $isFullPath, $msg );
                $this->db->scrollableCursor( $prevScroll );
                $this->db->prepareStatements( $prevPrep );
+               return true;
        }
 
        /**
index 9ba8d02..008240a 100644 (file)
@@ -839,7 +839,7 @@ END;
                if ( !$this->db->tableExists( $table, __METHOD__ ) ) {
                        $this->output( "...skipping: '$table' table doesn't exist yet.\n" );
 
-                       return;
+                       return true;
                }
 
                // Second requirement: the new index must be missing
@@ -853,17 +853,18 @@ END;
                                        "            $old should be manually removed if not needed anymore.\n" );
                        }
 
-                       return;
+                       return true;
                }
 
                // Third requirement: the old index must exist
                if ( !$this->db->indexExists( $table, $old, __METHOD__ ) ) {
                        $this->output( "...skipping: index $old doesn't exist.\n" );
 
-                       return;
+                       return true;
                }
 
                $this->db->query( "ALTER INDEX $old RENAME TO $new" );
+               return true;
        }
 
        protected function dropPgField( $table, $field ) {
index 456058e..9f80489 100644 (file)
@@ -59,6 +59,7 @@ class WebInstallerComplete extends WebInstallerPage {
 
                $this->parent->restoreLinkPopups();
                $this->endForm( false, false );
+               return '';
        }
 
 }
index f79d272..5241b3c 100644 (file)
@@ -32,6 +32,7 @@ abstract class WebInstallerDocument extends WebInstallerPage {
                $this->parent->output->addWikiTextAsInterface( $text );
                $this->startForm();
                $this->endForm( false );
+               return '';
        }
 
        /**
index 55cb942..060003b 100644 (file)
@@ -106,13 +106,13 @@ abstract class Job implements IJobSpecification {
 
        /**
         * @param string $command
-        * @param array|Title $params
+        * @param array|Title|null $params
         */
-       public function __construct( $command, $params = [] ) {
+       public function __construct( $command, $params = null ) {
                if ( $params instanceof Title ) {
                        // Backwards compatibility for old signature ($command, $title, $params)
                        $title = $params;
-                       $params = func_num_args() >= 3 ? func_get_arg( 2 ) : [];
+                       $params = func_get_arg( 2 );
                } else {
                        // Subclasses can override getTitle() to return something more meaningful
                        $title = Title::makeTitle( NS_SPECIAL, 'Blankpage' );
@@ -120,7 +120,7 @@ abstract class Job implements IJobSpecification {
 
                $this->command = $command;
                $this->title = $title;
-               $this->params = is_array( $params ) ? $params : []; // sanity
+               $this->params = is_array( $params ) ? $params : [];
                if ( !isset( $this->params['requestId'] ) ) {
                        $this->params['requestId'] = WebRequest::getRequestId();
                }
index b71580a..3b2c899 100644 (file)
@@ -96,5 +96,6 @@ class ClearWatchlistNotificationsJob extends Job {
                                $firstBatch = false;
                        }
                } while ( $idsToUpdate );
+               return true;
        }
 }
index e08da61..413fb2a 100644 (file)
@@ -806,6 +806,8 @@ EOT;
                if ( $eocdrPos !== false ) {
                        $this->logger->info( __METHOD__ . ": ZIP signature present in $file\n" );
                        // Check if it really is a ZIP file, make sure the EOCDR is at the end (T40432)
+                       // FIXME: unpack()'s third argument was added in PHP 7.1
+                       // @phan-suppress-next-line PhanParamTooManyInternal
                        $commentLength = unpack( "n", $tail, $eocdrPos + 20 )[0];
                        if ( $eocdrPos + 22 + $commentLength !== strlen( $tail ) ) {
                                $this->logger->info( __METHOD__ . ": ZIP EOCDR not at end. Not a ZIP file." );
index 746f3f5..0b52391 100644 (file)
@@ -72,7 +72,7 @@ class XmlTypeCheck {
         * Additional parsing options
         */
        private $parserOptions = [
-               'processing_instruction_handler' => '',
+               'processing_instruction_handler' => null,
                'external_dtd_handler' => '',
                'dtd_handler' => '',
                'require_safe_dtd' => true
index 1cc07b7..937ca55 100644 (file)
@@ -255,8 +255,6 @@ class MemcachedClient {
         * Memcache initializer
         *
         * @param array $args Associative array of settings
-        *
-        * @return mixed
         */
        public function __construct( $args ) {
                $this->set_servers( $args['servers'] ?? array() );
index 489f001..692771d 100644 (file)
@@ -138,6 +138,9 @@ class MemcachedPeclBagOStuff extends MemcachedBagOStuff {
                return $params;
        }
 
+       /**
+        * @suppress PhanTypeNonVarPassByRef
+        */
        protected function doGet( $key, $flags = 0, &$casToken = null ) {
                $this->debugLog( "get($key)" );
                if ( defined( Memcached::class . '::GET_EXTENDED' ) ) { // v3.0.0
index 3e71e36..62a2968 100644 (file)
@@ -72,7 +72,7 @@ class ChronologyProtector implements LoggerAwareInterface {
 
        /**
         * @param BagOStuff $store
-        * @param array[] $client Map of (ip: <IP>, agent: <user-agent> [, clientId: <hash>] )
+        * @param array $client Map of (ip: <IP>, agent: <user-agent> [, clientId: <hash>] )
         * @param int|null $posIndex Write counter index [optional]
         * @since 1.27
         */
index 2739205..a839946 100644 (file)
@@ -3580,6 +3580,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
                                list( $phpCallback ) = $callback;
                                $this->clearFlag( self::DBO_TRX ); // make each query its own transaction
                                try {
+                                       // @phan-suppress-next-line PhanParamTooManyCallable
                                        call_user_func( $phpCallback, $trigger, $this );
                                } catch ( Exception $ex ) {
                                        call_user_func( $this->errorLogger, $ex );
index b4440d6..90b888d 100644 (file)
@@ -1554,7 +1554,6 @@ interface IDatabase {
         *
         * @param callable $callback
         * @param string $fname Caller name
-        * @return mixed
         * @since 1.28
         */
        public function onTransactionResolution( callable $callback, $fname = __METHOD__ );
@@ -1598,7 +1597,6 @@ interface IDatabase {
         *
         * @param callable $callback
         * @param string $fname
-        * @return mixed
         * @since 1.20
         * @deprecated Since 1.32
         */
@@ -1644,7 +1642,6 @@ interface IDatabase {
         *
         * @param string $name Callback name
         * @param callable|null $callback Use null to unset a listener
-        * @return mixed
         * @since 1.28
         */
        public function setTransactionListener( $name, callable $callback = null );
@@ -2172,7 +2169,6 @@ interface IDatabase {
         * the aliases can be removed, and then the old X-named indexes dropped.
         *
         * @param string[] $aliases
-        * @return mixed
         * @since 1.31
         */
        public function setIndexAliases( array $aliases );
index 8e68aba..97d5072 100644 (file)
@@ -6,11 +6,11 @@ class MssqlBlob extends Blob {
        /** @noinspection PhpMissingParentConstructorInspection */
 
        /**
-        * @param string $data
+        * @param Blob|array|string $data
         */
        public function __construct( $data ) {
                if ( $data instanceof MssqlBlob ) {
-                       return $data;
+                       $this->data = $data->data;
                } elseif ( $data instanceof Blob ) {
                        $this->data = $data->fetch();
                } elseif ( is_array( $data ) && is_object( $data ) ) {
index 98c06ad..cb8be21 100644 (file)
@@ -390,7 +390,6 @@ interface ILBFactory {
         * the aliases can be removed, and then the old X-named indexes dropped.
         *
         * @param string[] $aliases
-        * @return mixed
         * @since 1.31
         */
        public function setIndexAliases( array $aliases );
index b20bf04..52d8370 100644 (file)
@@ -291,13 +291,13 @@ interface ILoadBalancer {
         *
         * @see ILoadBalancer::getConnection() for parameter information
         *
-        * @param int $db Server index or DB_MASTER/DB_REPLICA
+        * @param int $i Server index or DB_MASTER/DB_REPLICA
         * @param array|string|bool $groups Query group(s), or false for the generic reader
         * @param string|bool $domain Domain ID, or false for the current domain
         * @param int $flags Bitfield of CONN_* class constants (e.g. CONN_TRX_AUTOCOMMIT)
         * @return MaintainableDBConnRef
         */
-       public function getMaintenanceConnectionRef( $db, $groups = [], $domain = false, $flags = 0 );
+       public function getMaintenanceConnectionRef( $i, $groups = [], $domain = false, $flags = 0 );
 
        /**
         * Open a connection to the server given by the specified index
@@ -680,7 +680,6 @@ interface ILoadBalancer {
         * the aliases can be removed, and then the old X-named indexes dropped.
         *
         * @param string[] $aliases
-        * @return mixed
         * @since 1.31
         */
        public function setIndexAliases( array $aliases );
index 60237ff..6c1ac39 100644 (file)
@@ -1222,7 +1222,7 @@ EOT
         * @return TitleArray|Title[]
         */
        public function getForeignCategories() {
-               $this->mPage->getForeignCategories();
+               return $this->mPage->getForeignCategories();
        }
 
 }
index 4b0e503..655fa27 100644 (file)
@@ -2997,7 +2997,7 @@ class WikiPage implements Page, IDBAccessObject {
         * @param Content|null $content Page content to be used when determining
         *   the required updates. This may be needed because $this->getContent()
         *   may already return null when the page proper was deleted.
-        * @param RevisionRecord|Revision|null $revision The current page revision at the time of
+        * @param Revision|null $revision The current page revision at the time of
         *   deletion, used when determining the required updates. This may be needed because
         *   $this->getRevision() may already return null when the page proper was deleted.
         * @param User|null $user The user that caused the deletion
index 1017e44..fe46798 100644 (file)
@@ -32,9 +32,11 @@ class ProfilerStub extends Profiler {
        }
 
        public function getFunctionStats() {
+               return [];
        }
 
        public function getOutput() {
+               return '';
        }
 
        public function close() {
index f76d771..7e69a02 100644 (file)
@@ -32,5 +32,6 @@ class UDPRCFeedEngine extends RCFeedEngine {
        public function send( array $feed, $line ) {
                $transport = UDPTransport::newFromString( $feed['uri'] );
                $transport->emit( $line );
+               return true;
        }
 }
index 839948d..4cf8735 100644 (file)
@@ -319,8 +319,6 @@ class ResourceLoader implements LoggerAwareInterface {
         * @throws MWException If a duplicate module registration is attempted
         * @throws MWException If a module name contains illegal characters (pipes or commas)
         * @throws MWException If something other than a ResourceLoaderModule is being registered
-        * @return bool False if there were any errors, in which case one or more modules were
-        *   not registered
         */
        public function register( $name, $info = null ) {
                $moduleSkinStyles = $this->config->get( 'ResourceModuleSkinStyles' );
index ff1e8cb..22f5998 100644 (file)
@@ -22,6 +22,7 @@ class NullIndexField implements SearchIndexField {
         * @return $this
         */
        public function setFlag( $flag, $unset = false ) {
+               return $this;
        }
 
        /**
index 0e0a26a..101570f 100644 (file)
@@ -710,7 +710,6 @@ abstract class AuthManagerSpecialPage extends SpecialPage {
         * are shown closer to the bottom; weight defaults to 0. Negative weight is allowed.)
         * Keep order if weights are equal.
         * @param array &$formDescriptor
-        * @return array
         */
        protected static function sortFormDescriptorFields( array &$formDescriptor ) {
                $i = 0;
index 82bc84d..9e7e21d 100644 (file)
@@ -1072,6 +1072,7 @@ abstract class ChangesListSpecialPage extends SpecialPage {
                                $filterDefinition = $this->transformFilterDefinition( $filterDefinition );
                        }
 
+                       // @phan-suppress-next-line PhanNonClassMethodCall
                        $this->registerFilterGroup( new $className( $groupDefinition ) );
                }
        }
index 8df6493..722251d 100644 (file)
@@ -68,6 +68,7 @@ abstract class ImageQueryPage extends QueryPage {
 
        // Gotta override this since it's abstract
        function formatResult( $skin, $result ) {
+               return false;
        }
 
        /**
index b558d5e..155d6a4 100644 (file)
@@ -620,6 +620,7 @@ class SpecialBlock extends FormSpecialPage {
         *     the HTMLForm
         * @param WebRequest|null $request Optionally try and get data from a request too
         * @return array [ User|string|null, Block::TYPE_ constant|null ]
+        * @phan-return array{0:User|string|null,1:int|null}
         */
        public static function getTargetAndType( $par, WebRequest $request = null ) {
                $i = 0;
index 9d1b79e..36928ca 100644 (file)
@@ -44,7 +44,6 @@ class SpecialComparePages extends SpecialPage {
         * Show a form for filtering namespace and username
         *
         * @param string|null $par
-        * @return string
         */
        public function execute( $par ) {
                $this->setHeaders();
index 887f905..ded0891 100644 (file)
@@ -298,7 +298,6 @@ class SpecialEmailUser extends UnlistedSpecialPage {
         * Form to ask for target user name.
         *
         * @param string $name User name submitted.
-        * @return string Form asking for user name.
         */
        protected function userForm( $name ) {
                $htmlForm = HTMLForm::factory( 'ooui', [
index 619665b..9ea5e08 100644 (file)
@@ -154,7 +154,6 @@ class SpecialExpandTemplates extends SpecialPage {
         *
         * @param string $title Value for context title field
         * @param string $input Value for input textbox
-        * @return string
         */
        private function makeForm( $title, $input ) {
                $fields = [
index 2599b16..e8e5ea0 100644 (file)
@@ -132,6 +132,7 @@ class MIMEsearchPage extends QueryPage {
                        ->setMethod( 'get' )
                        ->prepareForm()
                        ->displayForm( false );
+               return '';
        }
 
        protected function getSuggestionsForTypes() {
index 52db060..7e41305 100644 (file)
@@ -44,6 +44,7 @@ class SpecialPageLanguage extends FormSpecialPage {
 
        protected function preText() {
                $this->getOutput()->addModules( 'mediawiki.special.pageLanguage' );
+               return parent::preText();
        }
 
        protected function getFormFields() {
index 51d6fd9..5f69426 100644 (file)
@@ -549,7 +549,6 @@ class SpecialUndelete extends SpecialPage {
         *
         * @param Revision $previousRev
         * @param Revision $currentRev
-        * @return string HTML
         */
        function showDiff( $previousRev, $currentRev ) {
                $diffContext = clone $this->getContext();
index da4398a..7a47edf 100644 (file)
@@ -393,7 +393,7 @@ class UploadForm extends HTMLForm {
         */
        public function show() {
                $this->addUploadJS();
-               parent::show();
+               return parent::show();
        }
 
        /**
index d05ebf8..88dff6e 100644 (file)
@@ -204,5 +204,6 @@ class NewFilesPager extends RangeChronologicalPager {
                        . htmlspecialchars( $time )
                        . "</i><br />\n"
                );
+               return '';
        }
 }
index f42b5a0..f2bc615 100644 (file)
@@ -77,7 +77,7 @@ class BatchRowUpdate {
                $this->reader = $reader;
                $this->writer = $writer;
                $this->generator = $generator;
-               $this->output = function () {
+               $this->output = function ( $text ) {
                }; // nop
        }
 
index 8aa7c87..c5ff9d6 100644 (file)
@@ -60,7 +60,13 @@ class LanguageConverter {
        public $mVariantFallbacks;
        public $mVariantNames;
        public $mTablesLoaded = false;
+
+       /**
+        * @var ReplacementArray[]
+        * @phan-var array<string,ReplacementArray>
+        */
        public $mTables;
+
        // 'bidirectional' 'unidirectional' 'disable' for each variant
        public $mManualLevel;
 
index 1ba7054..591fbd4 100644 (file)
@@ -93,6 +93,7 @@ class PopulatePPSortKey extends LoggedUpdateMaintenance {
                }
 
                $this->output( "Populating page_props.pp_sortkey complete.\n" );
+               return true;
        }
 
        protected function getUpdateKey() {
index d5d27ad..8df01e6 100644 (file)
@@ -239,7 +239,7 @@ class PPFuzzTest {
 class PPFuzzUser extends User {
        public $ppfz_test, $mDataLoaded;
 
-       function load() {
+       function load( $flags = null ) {
                if ( $this->mDataLoaded ) {
                        return;
                }
index 7f36442..7f89ce9 100644 (file)
@@ -274,7 +274,9 @@ class RecompressTracked {
        function dispatch( /*...*/ ) {
                $args = func_get_args();
                $pipes = $this->replicaPipes;
-               $numPipes = stream_select( $x = [], $pipes, $y = [], 3600 );
+               $x = [];
+               $y = [];
+               $numPipes = stream_select( $x, $pipes, $y, 3600 );
                if ( !$numPipes ) {
                        $this->critical( "Error waiting to write to replica DBs. Aborting" );
                        exit( 1 );
index f43f0a9..5119d73 100644 (file)
@@ -1364,6 +1364,9 @@ abstract class MediaWikiTestCase extends PHPUnit\Framework\TestCase {
                        JobQueueGroup::singleton()->get( $type )->delete();
                }
 
+               // T219673: close any connections from code that failed to call reuseConnection()
+               // or is still holding onto a DBConnRef instance (e.g. in a singleton).
+               MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->closeAll();
                CloneDatabase::changePrefix( self::$oldTablePrefix );
 
                self::$oldTablePrefix = false;