Use precise ApiMain/ApiQuery type hints in all API modules
authorThiemo Mättig <thiemo.maettig@wikimedia.de>
Tue, 25 Mar 2014 17:22:11 +0000 (18:22 +0100)
committerBrad Jorsch <bjorsch@wikimedia.org>
Fri, 16 May 2014 15:07:23 +0000 (11:07 -0400)
Which type is used depends on the ApiModuleManager responsible for
the API module. There are two managers, one in ApiMain and one in
ApiQuery. Both contain a list of API modules they instantiate.
Both use $this as the first parameter in the constructors of the
individual modules. There is no other regular way to instantiate the
modules, so we know the type must either be ApiMain or ApiQuery.

The lists don't intersect.

I would have prefered the naming scheme $mainModule for ApiMain
modules and $queryModule for ApiQuery modules but since this
doesn't add much I left the shorter variable names untouched.

Change-Id: Ie6bf19150f1c9b619655a06a8e051412665e54db

57 files changed:
includes/api/ApiFormatBase.php
includes/api/ApiFormatJson.php
includes/api/ApiFormatRaw.php
includes/api/ApiLogin.php
includes/api/ApiModuleManager.php
includes/api/ApiPageSet.php
includes/api/ApiParamInfo.php
includes/api/ApiQuery.php
includes/api/ApiQueryAllCategories.php
includes/api/ApiQueryAllImages.php
includes/api/ApiQueryAllLinks.php
includes/api/ApiQueryAllMessages.php
includes/api/ApiQueryAllPages.php
includes/api/ApiQueryAllUsers.php
includes/api/ApiQueryBacklinks.php
includes/api/ApiQueryBase.php
includes/api/ApiQueryBlocks.php
includes/api/ApiQueryCategories.php
includes/api/ApiQueryCategoryInfo.php
includes/api/ApiQueryCategoryMembers.php
includes/api/ApiQueryContributors.php
includes/api/ApiQueryDeletedrevs.php
includes/api/ApiQueryDuplicateFiles.php
includes/api/ApiQueryExtLinksUsage.php
includes/api/ApiQueryExternalLinks.php
includes/api/ApiQueryFileRepoInfo.php
includes/api/ApiQueryFilearchive.php
includes/api/ApiQueryIWBacklinks.php
includes/api/ApiQueryIWLinks.php
includes/api/ApiQueryImageInfo.php
includes/api/ApiQueryImages.php
includes/api/ApiQueryInfo.php
includes/api/ApiQueryLangBacklinks.php
includes/api/ApiQueryLangLinks.php
includes/api/ApiQueryLinks.php
includes/api/ApiQueryLogEvents.php
includes/api/ApiQueryPagePropNames.php
includes/api/ApiQueryPageProps.php
includes/api/ApiQueryPagesWithProp.php
includes/api/ApiQueryProtectedTitles.php
includes/api/ApiQueryQueryPage.php
includes/api/ApiQueryRandom.php
includes/api/ApiQueryRecentChanges.php
includes/api/ApiQueryRedirects.php
includes/api/ApiQueryRevisions.php
includes/api/ApiQuerySearch.php
includes/api/ApiQuerySiteinfo.php
includes/api/ApiQueryStashImageInfo.php
includes/api/ApiQueryTags.php
includes/api/ApiQueryUserContributions.php
includes/api/ApiQueryUserInfo.php
includes/api/ApiQueryUsers.php
includes/api/ApiQueryWatchlist.php
includes/api/ApiQueryWatchlistRaw.php
includes/api/ApiResult.php
includes/api/ApiRsd.php
tests/phpunit/includes/api/PrefixUniquenessTest.php

index 15b97d8..8954abc 100644 (file)
@@ -34,12 +34,11 @@ abstract class ApiFormatBase extends ApiBase {
        private $mBufferResult = false, $mBuffer, $mDisabled = false;
 
        /**
-        * Constructor
         * If $format ends with 'fm', pretty-print the output in HTML.
         * @param ApiMain $main
         * @param string $format Format name
         */
-       public function __construct( $main, $format ) {
+       public function __construct( ApiMain $main, $format ) {
                parent::__construct( $main, $format );
 
                $this->mIsHtml = ( substr( $format, -2, 2 ) === 'fm' ); // ends with 'fm'
@@ -347,7 +346,7 @@ See the <a href='https://www.mediawiki.org/wiki/API'>complete documentation</a>,
  */
 class ApiFormatFeedWrapper extends ApiFormatBase {
 
-       public function __construct( $main ) {
+       public function __construct( ApiMain $main ) {
                parent::__construct( $main, 'feed' );
        }
 
index be0b58b..e2c6b9a 100644 (file)
@@ -32,7 +32,7 @@ class ApiFormatJson extends ApiFormatBase {
 
        private $mIsRaw;
 
-       public function __construct( $main, $format ) {
+       public function __construct( ApiMain $main, $format ) {
                parent::__construct( $main, $format );
                $this->mIsRaw = ( $format === 'rawfm' );
        }
index af17554..3f5c8b7 100644 (file)
 class ApiFormatRaw extends ApiFormatBase {
 
        /**
-        * Constructor
         * @param ApiMain $main
-        * @param ApiFormatBase $errorFallback ApiFormatBase object to fall back on for errors
+        * @param ApiFormatBase $errorFallback Object to fall back on for errors
         */
-       public function __construct( $main, $errorFallback ) {
+       public function __construct( ApiMain $main, ApiFormatBase $errorFallback ) {
                parent::__construct( $main, 'raw' );
                $this->mErrorFallback = $errorFallback;
        }
index 46e2a53..6336e81 100644 (file)
@@ -32,7 +32,7 @@
  */
 class ApiLogin extends ApiBase {
 
-       public function __construct( $main, $action ) {
+       public function __construct( ApiMain $main, $action ) {
                parent::__construct( $main, $action, 'lg' );
        }
 
index 935fa42..8226529 100644 (file)
  */
 class ApiModuleManager extends ContextSource {
 
+       /**
+        * @var ApiBase
+        */
        private $mParent;
+       /**
+        * @var ApiBase[]
+        */
        private $mInstances = array();
+       /**
+        * @var null[]
+        */
        private $mGroups = array();
+       /**
+        * @var array[]
+        */
        private $mModules = array();
 
        /**
index 804a857..20444d0 100644 (file)
@@ -98,7 +98,6 @@ class ApiPageSet extends ApiBase {
        }
 
        /**
-        * Constructor
         * @param ApiBase $dbSource Module implementing getDB().
         *        Allows PageSet to reuse existing db connection from the shared state like ApiQuery.
         * @param int $flags Zero or more flags like DISABLE_GENERATORS
index 7f9ad4c..622e3a6 100644 (file)
@@ -34,7 +34,7 @@ class ApiParamInfo extends ApiBase {
         */
        protected $queryObj;
 
-       public function __construct( $main, $action ) {
+       public function __construct( ApiMain $main, $action ) {
                parent::__construct( $main, $action );
                $this->queryObj = new ApiQuery( $this->getMain(), 'query' );
        }
index d1bddbf..fc115b8 100644 (file)
@@ -125,7 +125,7 @@ class ApiQuery extends ApiBase {
         * @param ApiMain $main
         * @param string $action
         */
-       public function __construct( $main, $action ) {
+       public function __construct( ApiMain $main, $action ) {
                parent::__construct( $main, $action );
 
                $this->mModuleMgr = new ApiModuleManager( $this );
index 38ec127..1b65097 100644 (file)
@@ -32,7 +32,7 @@
  */
 class ApiQueryAllCategories extends ApiQueryGeneratorBase {
 
-       public function __construct( $query, $moduleName ) {
+       public function __construct( ApiQuery $query, $moduleName ) {
                parent::__construct( $query, $moduleName, 'ac' );
        }
 
index 669351f..4266a8e 100644 (file)
@@ -34,7 +34,7 @@
 class ApiQueryAllImages extends ApiQueryGeneratorBase {
        protected $mRepo;
 
-       public function __construct( $query, $moduleName ) {
+       public function __construct( ApiQuery $query, $moduleName ) {
                parent::__construct( $query, $moduleName, 'ai' );
                $this->mRepo = RepoGroup::singleton()->getLocalRepo();
        }
index 9324acb..61bc90e 100644 (file)
@@ -39,7 +39,7 @@ class ApiQueryAllLinks extends ApiQueryGeneratorBase {
        private $useIndex = null;
        private $props = array(), $propHelp = array();
 
-       public function __construct( $query, $moduleName ) {
+       public function __construct( ApiQuery $query, $moduleName ) {
                switch ( $moduleName ) {
                        case 'alllinks':
                                $prefix = 'al';
index 09f40fd..8d4af0b 100644 (file)
@@ -31,7 +31,7 @@
  */
 class ApiQueryAllMessages extends ApiQueryBase {
 
-       public function __construct( $query, $moduleName ) {
+       public function __construct( ApiQuery $query, $moduleName ) {
                parent::__construct( $query, $moduleName, 'am' );
        }
 
index 4ac9485..b283177 100644 (file)
@@ -31,7 +31,7 @@
  */
 class ApiQueryAllPages extends ApiQueryGeneratorBase {
 
-       public function __construct( $query, $moduleName ) {
+       public function __construct( ApiQuery $query, $moduleName ) {
                parent::__construct( $query, $moduleName, 'ap' );
        }
 
index df8db16..42464ef 100644 (file)
@@ -30,7 +30,7 @@
  * @ingroup API
  */
 class ApiQueryAllUsers extends ApiQueryBase {
-       public function __construct( $query, $moduleName ) {
+       public function __construct( ApiQuery $query, $moduleName ) {
                parent::__construct( $query, $moduleName, 'au' );
        }
 
index 524dda4..8dc2a65 100644 (file)
@@ -75,7 +75,7 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
                )
        );
 
-       public function __construct( $query, $moduleName ) {
+       public function __construct( ApiQuery $query, $moduleName ) {
                $settings = $this->backlinksSettings[$moduleName];
                $prefix = $settings['prefix'];
                $code = $settings['code'];
index eac25e6..01384c0 100644 (file)
@@ -36,13 +36,13 @@ abstract class ApiQueryBase extends ApiBase {
        private $mQueryModule, $mDb, $tables, $where, $fields, $options, $join_conds;
 
        /**
-        * @param ApiBase $query
+        * @param ApiQuery $queryModule
         * @param string $moduleName
         * @param string $paramPrefix
         */
-       public function __construct( ApiBase $query, $moduleName, $paramPrefix = '' ) {
-               parent::__construct( $query->getMain(), $moduleName, $paramPrefix );
-               $this->mQueryModule = $query;
+       public function __construct( ApiQuery $queryModule, $moduleName, $paramPrefix = '' ) {
+               parent::__construct( $queryModule->getMain(), $moduleName, $paramPrefix );
+               $this->mQueryModule = $queryModule;
                $this->mDb = null;
                $this->resetQueryParams();
        }
index f69b310..7d27a64 100644 (file)
@@ -36,7 +36,7 @@ class ApiQueryBlocks extends ApiQueryBase {
         */
        protected $usernames;
 
-       public function __construct( $query, $moduleName ) {
+       public function __construct( ApiQuery $query, $moduleName ) {
                parent::__construct( $query, $moduleName, 'bk' );
        }
 
index 90e8ed7..cfc76e6 100644 (file)
@@ -31,7 +31,7 @@
  */
 class ApiQueryCategories extends ApiQueryGeneratorBase {
 
-       public function __construct( $query, $moduleName ) {
+       public function __construct( ApiQuery $query, $moduleName ) {
                parent::__construct( $query, $moduleName, 'cl' );
        }
 
index d0e3a36..8097b7b 100644 (file)
@@ -32,7 +32,7 @@
  */
 class ApiQueryCategoryInfo extends ApiQueryBase {
 
-       public function __construct( $query, $moduleName ) {
+       public function __construct( ApiQuery $query, $moduleName ) {
                parent::__construct( $query, $moduleName, 'ci' );
        }
 
index 14c2f81..a3bc3b9 100644 (file)
@@ -31,7 +31,7 @@
  */
 class ApiQueryCategoryMembers extends ApiQueryGeneratorBase {
 
-       public function __construct( $query, $moduleName ) {
+       public function __construct( ApiQuery $query, $moduleName ) {
                parent::__construct( $query, $moduleName, 'cm' );
        }
 
index 912ac02..b90283f 100644 (file)
@@ -38,7 +38,7 @@ class ApiQueryContributors extends ApiQueryBase {
         */
        const MAX_PAGES = 100;
 
-       public function __construct( $query, $moduleName ) {
+       public function __construct( ApiQuery $query, $moduleName ) {
                // "pc" is short for "page contributors", "co" was already taken by the
                // GeoData extension's prop=coordinates.
                parent::__construct( $query, $moduleName, 'pc' );
index 2ca93f5..af0d938 100644 (file)
@@ -31,7 +31,7 @@
  */
 class ApiQueryDeletedrevs extends ApiQueryBase {
 
-       public function __construct( $query, $moduleName ) {
+       public function __construct( ApiQuery $query, $moduleName ) {
                parent::__construct( $query, $moduleName, 'dr' );
        }
 
index 3105f91..4645402 100644 (file)
@@ -31,7 +31,7 @@
  */
 class ApiQueryDuplicateFiles extends ApiQueryGeneratorBase {
 
-       public function __construct( $query, $moduleName ) {
+       public function __construct( ApiQuery $query, $moduleName ) {
                parent::__construct( $query, $moduleName, 'df' );
        }
 
index da095e6..070681c 100644 (file)
@@ -29,7 +29,7 @@
  */
 class ApiQueryExtLinksUsage extends ApiQueryGeneratorBase {
 
-       public function __construct( $query, $moduleName ) {
+       public function __construct( ApiQuery $query, $moduleName ) {
                parent::__construct( $query, $moduleName, 'eu' );
        }
 
index f7a0958..e3a7be3 100644 (file)
@@ -31,7 +31,7 @@
  */
 class ApiQueryExternalLinks extends ApiQueryBase {
 
-       public function __construct( $query, $moduleName ) {
+       public function __construct( ApiQuery $query, $moduleName ) {
                parent::__construct( $query, $moduleName, 'el' );
        }
 
index d9579a1..d1600ef 100644 (file)
@@ -29,7 +29,7 @@
  */
 class ApiQueryFileRepoInfo extends ApiQueryBase {
 
-       public function __construct( $query, $moduleName ) {
+       public function __construct( ApiQuery $query, $moduleName ) {
                parent::__construct( $query, $moduleName, 'fri' );
        }
 
index e12d927..97918e3 100644 (file)
@@ -33,7 +33,7 @@
  */
 class ApiQueryFilearchive extends ApiQueryBase {
 
-       public function __construct( $query, $moduleName ) {
+       public function __construct( ApiQuery $query, $moduleName ) {
                parent::__construct( $query, $moduleName, 'fa' );
        }
 
index ec5453c..35b2b40 100644 (file)
@@ -31,7 +31,7 @@
  */
 class ApiQueryIWBacklinks extends ApiQueryGeneratorBase {
 
-       public function __construct( $query, $moduleName ) {
+       public function __construct( ApiQuery $query, $moduleName ) {
                parent::__construct( $query, $moduleName, 'iwbl' );
        }
 
index a7b69a0..f38a7b1 100644 (file)
@@ -32,7 +32,7 @@
  */
 class ApiQueryIWLinks extends ApiQueryBase {
 
-       public function __construct( $query, $moduleName ) {
+       public function __construct( ApiQuery $query, $moduleName ) {
                parent::__construct( $query, $moduleName, 'iw' );
        }
 
index 5c410a4..5a82f19 100644 (file)
@@ -33,7 +33,7 @@ class ApiQueryImageInfo extends ApiQueryBase {
        const TRANSFORM_LIMIT = 50;
        private static $transformCount = 0;
 
-       public function __construct( $query, $moduleName, $prefix = 'ii' ) {
+       public function __construct( ApiQuery $query, $moduleName, $prefix = 'ii' ) {
                // We allow a subclass to override the prefix, to create a related API
                // module. Some other parts of MediaWiki construct this with a null
                // $prefix, which used to be ignored when this only took two arguments
index 032050e..87b0778 100644 (file)
@@ -32,7 +32,7 @@
  */
 class ApiQueryImages extends ApiQueryGeneratorBase {
 
-       public function __construct( $query, $moduleName ) {
+       public function __construct( ApiQuery $query, $moduleName ) {
                parent::__construct( $query, $moduleName, 'im' );
        }
 
index 7a70299..f160791 100644 (file)
@@ -48,7 +48,7 @@ class ApiQueryInfo extends ApiQueryBase {
 
        private $tokenFunctions;
 
-       public function __construct( $query, $moduleName ) {
+       public function __construct( ApiQuery $query, $moduleName ) {
                parent::__construct( $query, $moduleName, 'in' );
        }
 
index 5f28654..13711e6 100644 (file)
@@ -31,7 +31,7 @@
  */
 class ApiQueryLangBacklinks extends ApiQueryGeneratorBase {
 
-       public function __construct( $query, $moduleName ) {
+       public function __construct( ApiQuery $query, $moduleName ) {
                parent::__construct( $query, $moduleName, 'lbl' );
        }
 
index 8e155f2..53cfba1 100644 (file)
@@ -31,7 +31,7 @@
  */
 class ApiQueryLangLinks extends ApiQueryBase {
 
-       public function __construct( $query, $moduleName ) {
+       public function __construct( ApiQuery $query, $moduleName ) {
                parent::__construct( $query, $moduleName, 'll' );
        }
 
index dd816cf..7c17938 100644 (file)
@@ -36,7 +36,7 @@ class ApiQueryLinks extends ApiQueryGeneratorBase {
 
        private $table, $prefix, $description, $helpUrl;
 
-       public function __construct( $query, $moduleName ) {
+       public function __construct( ApiQuery $query, $moduleName ) {
                switch ( $moduleName ) {
                        case self::LINKS:
                                $this->table = 'pagelinks';
index 7062570..bb424ee 100644 (file)
@@ -31,7 +31,7 @@
  */
 class ApiQueryLogEvents extends ApiQueryBase {
 
-       public function __construct( $query, $moduleName ) {
+       public function __construct( ApiQuery $query, $moduleName ) {
                parent::__construct( $query, $moduleName, 'le' );
        }
 
index c387475..8cd9c6c 100644 (file)
@@ -32,7 +32,7 @@
  */
 class ApiQueryPagePropNames extends ApiQueryBase {
 
-       public function __construct( $query, $moduleName ) {
+       public function __construct( ApiQuery $query, $moduleName ) {
                parent::__construct( $query, $moduleName, 'ppn' );
        }
 
index b68a385..e370c39 100644 (file)
@@ -33,7 +33,7 @@ class ApiQueryPageProps extends ApiQueryBase {
 
        private $params;
 
-       public function __construct( $query, $moduleName ) {
+       public function __construct( ApiQuery $query, $moduleName ) {
                parent::__construct( $query, $moduleName, 'pp' );
        }
 
index 4381485..b6c8525 100644 (file)
@@ -32,7 +32,7 @@
  */
 class ApiQueryPagesWithProp extends ApiQueryGeneratorBase {
 
-       public function __construct( $query, $moduleName ) {
+       public function __construct( ApiQuery $query, $moduleName ) {
                parent::__construct( $query, $moduleName, 'pwp' );
        }
 
index 368705d..8f120c6 100644 (file)
@@ -31,7 +31,7 @@
  */
 class ApiQueryProtectedTitles extends ApiQueryGeneratorBase {
 
-       public function __construct( $query, $moduleName ) {
+       public function __construct( ApiQuery $query, $moduleName ) {
                parent::__construct( $query, $moduleName, 'pt' );
        }
 
index 8ddc48a..45950e7 100644 (file)
@@ -32,7 +32,7 @@
 class ApiQueryQueryPage extends ApiQueryGeneratorBase {
        private $qpMap;
 
-       public function __construct( $query, $moduleName ) {
+       public function __construct( ApiQuery $query, $moduleName ) {
                parent::__construct( $query, $moduleName, 'qp' );
                // Build mapping from special page names to QueryPage classes
                global $wgAPIUselessQueryPages;
index a27edcf..07f8a0e 100644 (file)
@@ -33,7 +33,7 @@
 class ApiQueryRandom extends ApiQueryGeneratorBase {
        private $pageIDs;
 
-       public function __construct( $query, $moduleName ) {
+       public function __construct( ApiQuery $query, $moduleName ) {
                parent::__construct( $query, $moduleName, 'rn' );
        }
 
index f962ba0..c0c10b9 100644 (file)
@@ -32,7 +32,7 @@
  */
 class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
 
-       public function __construct( $query, $moduleName ) {
+       public function __construct( ApiQuery $query, $moduleName ) {
                parent::__construct( $query, $moduleName, 'rc' );
        }
 
index 2ed7d30..afb2c56 100644 (file)
@@ -32,7 +32,7 @@
  */
 class ApiQueryRedirects extends ApiQueryGeneratorBase {
 
-       public function __construct( $query, $moduleName ) {
+       public function __construct( ApiQuery $query, $moduleName ) {
                parent::__construct( $query, $moduleName, 'rd' );
        }
 
index 6150995..592c434 100644 (file)
@@ -37,7 +37,7 @@ class ApiQueryRevisions extends ApiQueryBase {
        private $diffto, $difftotext, $expandTemplates, $generateXML, $section,
                $token, $parseContent, $contentFormat;
 
-       public function __construct( $query, $moduleName ) {
+       public function __construct( ApiQuery $query, $moduleName ) {
                parent::__construct( $query, $moduleName, 'rv' );
        }
 
index 8eceb6f..d67fac2 100644 (file)
@@ -39,7 +39,7 @@ class ApiQuerySearch extends ApiQueryGeneratorBase {
         */
        const BACKEND_NULL_PARAM = 'database-backed';
 
-       public function __construct( $query, $moduleName ) {
+       public function __construct( ApiQuery $query, $moduleName ) {
                parent::__construct( $query, $moduleName, 'sr' );
        }
 
index 2124dc3..ea3a084 100644 (file)
@@ -31,7 +31,7 @@
  */
 class ApiQuerySiteinfo extends ApiQueryBase {
 
-       public function __construct( $query, $moduleName ) {
+       public function __construct( ApiQuery $query, $moduleName ) {
                parent::__construct( $query, $moduleName, 'si' );
        }
 
index c870835..d9409ec 100644 (file)
@@ -27,7 +27,7 @@
  */
 class ApiQueryStashImageInfo extends ApiQueryImageInfo {
 
-       public function __construct( $query, $moduleName ) {
+       public function __construct( ApiQuery $query, $moduleName ) {
                parent::__construct( $query, $moduleName, 'sii' );
        }
 
index 9e2559f..77c105a 100644 (file)
@@ -40,7 +40,7 @@ class ApiQueryTags extends ApiQueryBase {
        private $fld_displayname = false, $fld_description = false,
                $fld_hitcount = false;
 
-       public function __construct( $query, $moduleName ) {
+       public function __construct( ApiQuery $query, $moduleName ) {
                parent::__construct( $query, $moduleName, 'tg' );
        }
 
index 780b2fa..568ccb5 100644 (file)
@@ -31,7 +31,7 @@
  */
 class ApiQueryContributions extends ApiQueryBase {
 
-       public function __construct( $query, $moduleName ) {
+       public function __construct( ApiQuery $query, $moduleName ) {
                parent::__construct( $query, $moduleName, 'uc' );
        }
 
index 200b03b..ee5e458 100644 (file)
@@ -33,7 +33,7 @@ class ApiQueryUserInfo extends ApiQueryBase {
 
        private $prop = array();
 
-       public function __construct( $query, $moduleName ) {
+       public function __construct( ApiQuery $query, $moduleName ) {
                parent::__construct( $query, $moduleName, 'ui' );
        }
 
index ce92063..d0d0f08 100644 (file)
@@ -50,7 +50,7 @@ class ApiQueryUsers extends ApiQueryBase {
                'gender',
        );
 
-       public function __construct( $query, $moduleName ) {
+       public function __construct( ApiQuery $query, $moduleName ) {
                parent::__construct( $query, $moduleName, 'us' );
        }
 
index 869faea..b198883 100644 (file)
@@ -32,7 +32,7 @@
  */
 class ApiQueryWatchlist extends ApiQueryGeneratorBase {
 
-       public function __construct( $query, $moduleName ) {
+       public function __construct( ApiQuery $query, $moduleName ) {
                parent::__construct( $query, $moduleName, 'wl' );
        }
 
index 07efb52..6aae6dc 100644 (file)
@@ -32,7 +32,7 @@
  */
 class ApiQueryWatchlistRaw extends ApiQueryGeneratorBase {
 
-       public function __construct( $query, $moduleName ) {
+       public function __construct( ApiQuery $query, $moduleName ) {
                parent::__construct( $query, $moduleName, 'wr' );
        }
 
index c729238..c351561 100644 (file)
@@ -59,10 +59,9 @@ class ApiResult extends ApiBase {
        private $mData, $mIsRawMode, $mSize, $mCheckingSize;
 
        /**
-        * Constructor
         * @param ApiMain $main
         */
-       public function __construct( $main ) {
+       public function __construct( ApiMain $main ) {
                parent::__construct( $main, 'result' );
                $this->mIsRawMode = false;
                $this->mCheckingSize = true;
index 7a0f0c6..a2771a0 100644 (file)
@@ -160,7 +160,7 @@ class ApiRsd extends ApiBase {
 }
 
 class ApiFormatXmlRsd extends ApiFormatXml {
-       public function __construct( $main, $format ) {
+       public function __construct( ApiMain $main, $format ) {
                parent::__construct( $main, $format );
                $this->setRootElement( 'rsd' );
        }
index a1fc2c2..38beb87 100644 (file)
@@ -14,8 +14,8 @@ class PrefixUniquenessTest extends MediaWikiTestCase {
                $prefixes = array();
 
                foreach ( $modules as $name => $class ) {
-                       /** @var ApiMain $module */
-                       $module = new $class( $main, $name );
+                       /** @var ApiQueryBase $module */
+                       $module = new $class( $query, $name );
                        $prefix = $module->getModulePrefix();
                        if ( isset( $prefixes[$prefix] ) ) {
                                $this->fail( "Module prefix '{$prefix}' is shared between {$class} and {$prefixes[$prefix]}" );