From 23632a4ecddd5c6f181807ce776d3be1e1848a71 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thiemo=20M=C3=A4ttig?= Date: Tue, 25 Mar 2014 18:22:11 +0100 Subject: [PATCH] Use precise ApiMain/ApiQuery type hints in all API modules 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 --- includes/api/ApiFormatBase.php | 5 ++--- includes/api/ApiFormatJson.php | 2 +- includes/api/ApiFormatRaw.php | 5 ++--- includes/api/ApiLogin.php | 2 +- includes/api/ApiModuleManager.php | 12 ++++++++++++ includes/api/ApiPageSet.php | 1 - includes/api/ApiParamInfo.php | 2 +- includes/api/ApiQuery.php | 2 +- includes/api/ApiQueryAllCategories.php | 2 +- includes/api/ApiQueryAllImages.php | 2 +- includes/api/ApiQueryAllLinks.php | 2 +- includes/api/ApiQueryAllMessages.php | 2 +- includes/api/ApiQueryAllPages.php | 2 +- includes/api/ApiQueryAllUsers.php | 2 +- includes/api/ApiQueryBacklinks.php | 2 +- includes/api/ApiQueryBase.php | 8 ++++---- includes/api/ApiQueryBlocks.php | 2 +- includes/api/ApiQueryCategories.php | 2 +- includes/api/ApiQueryCategoryInfo.php | 2 +- includes/api/ApiQueryCategoryMembers.php | 2 +- includes/api/ApiQueryContributors.php | 2 +- includes/api/ApiQueryDeletedrevs.php | 2 +- includes/api/ApiQueryDuplicateFiles.php | 2 +- includes/api/ApiQueryExtLinksUsage.php | 2 +- includes/api/ApiQueryExternalLinks.php | 2 +- includes/api/ApiQueryFileRepoInfo.php | 2 +- includes/api/ApiQueryFilearchive.php | 2 +- includes/api/ApiQueryIWBacklinks.php | 2 +- includes/api/ApiQueryIWLinks.php | 2 +- includes/api/ApiQueryImageInfo.php | 2 +- includes/api/ApiQueryImages.php | 2 +- includes/api/ApiQueryInfo.php | 2 +- includes/api/ApiQueryLangBacklinks.php | 2 +- includes/api/ApiQueryLangLinks.php | 2 +- includes/api/ApiQueryLinks.php | 2 +- includes/api/ApiQueryLogEvents.php | 2 +- includes/api/ApiQueryPagePropNames.php | 2 +- includes/api/ApiQueryPageProps.php | 2 +- includes/api/ApiQueryPagesWithProp.php | 2 +- includes/api/ApiQueryProtectedTitles.php | 2 +- includes/api/ApiQueryQueryPage.php | 2 +- includes/api/ApiQueryRandom.php | 2 +- includes/api/ApiQueryRecentChanges.php | 2 +- includes/api/ApiQueryRedirects.php | 2 +- includes/api/ApiQueryRevisions.php | 2 +- includes/api/ApiQuerySearch.php | 2 +- includes/api/ApiQuerySiteinfo.php | 2 +- includes/api/ApiQueryStashImageInfo.php | 2 +- includes/api/ApiQueryTags.php | 2 +- includes/api/ApiQueryUserContributions.php | 2 +- includes/api/ApiQueryUserInfo.php | 2 +- includes/api/ApiQueryUsers.php | 2 +- includes/api/ApiQueryWatchlist.php | 2 +- includes/api/ApiQueryWatchlistRaw.php | 2 +- includes/api/ApiResult.php | 3 +-- includes/api/ApiRsd.php | 2 +- tests/phpunit/includes/api/PrefixUniquenessTest.php | 4 ++-- 57 files changed, 73 insertions(+), 65 deletions(-) diff --git a/includes/api/ApiFormatBase.php b/includes/api/ApiFormatBase.php index 15b97d8722..8954abc090 100644 --- a/includes/api/ApiFormatBase.php +++ b/includes/api/ApiFormatBase.php @@ -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 complete documentation, */ class ApiFormatFeedWrapper extends ApiFormatBase { - public function __construct( $main ) { + public function __construct( ApiMain $main ) { parent::__construct( $main, 'feed' ); } diff --git a/includes/api/ApiFormatJson.php b/includes/api/ApiFormatJson.php index be0b58b63b..e2c6b9ac94 100644 --- a/includes/api/ApiFormatJson.php +++ b/includes/api/ApiFormatJson.php @@ -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' ); } diff --git a/includes/api/ApiFormatRaw.php b/includes/api/ApiFormatRaw.php index af175543d2..3f5c8b7384 100644 --- a/includes/api/ApiFormatRaw.php +++ b/includes/api/ApiFormatRaw.php @@ -31,11 +31,10 @@ 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; } diff --git a/includes/api/ApiLogin.php b/includes/api/ApiLogin.php index 46e2a53d72..6336e81699 100644 --- a/includes/api/ApiLogin.php +++ b/includes/api/ApiLogin.php @@ -32,7 +32,7 @@ */ class ApiLogin extends ApiBase { - public function __construct( $main, $action ) { + public function __construct( ApiMain $main, $action ) { parent::__construct( $main, $action, 'lg' ); } diff --git a/includes/api/ApiModuleManager.php b/includes/api/ApiModuleManager.php index 935fa42070..822652977e 100644 --- a/includes/api/ApiModuleManager.php +++ b/includes/api/ApiModuleManager.php @@ -33,9 +33,21 @@ */ class ApiModuleManager extends ContextSource { + /** + * @var ApiBase + */ private $mParent; + /** + * @var ApiBase[] + */ private $mInstances = array(); + /** + * @var null[] + */ private $mGroups = array(); + /** + * @var array[] + */ private $mModules = array(); /** diff --git a/includes/api/ApiPageSet.php b/includes/api/ApiPageSet.php index 804a8575dd..20444d0f4a 100644 --- a/includes/api/ApiPageSet.php +++ b/includes/api/ApiPageSet.php @@ -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 diff --git a/includes/api/ApiParamInfo.php b/includes/api/ApiParamInfo.php index 7f9ad4c96c..622e3a60c6 100644 --- a/includes/api/ApiParamInfo.php +++ b/includes/api/ApiParamInfo.php @@ -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' ); } diff --git a/includes/api/ApiQuery.php b/includes/api/ApiQuery.php index d1bddbf9be..fc115b8993 100644 --- a/includes/api/ApiQuery.php +++ b/includes/api/ApiQuery.php @@ -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 ); diff --git a/includes/api/ApiQueryAllCategories.php b/includes/api/ApiQueryAllCategories.php index 38ec127866..1b65097d4c 100644 --- a/includes/api/ApiQueryAllCategories.php +++ b/includes/api/ApiQueryAllCategories.php @@ -32,7 +32,7 @@ */ class ApiQueryAllCategories extends ApiQueryGeneratorBase { - public function __construct( $query, $moduleName ) { + public function __construct( ApiQuery $query, $moduleName ) { parent::__construct( $query, $moduleName, 'ac' ); } diff --git a/includes/api/ApiQueryAllImages.php b/includes/api/ApiQueryAllImages.php index 669351fde3..4266a8e43f 100644 --- a/includes/api/ApiQueryAllImages.php +++ b/includes/api/ApiQueryAllImages.php @@ -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(); } diff --git a/includes/api/ApiQueryAllLinks.php b/includes/api/ApiQueryAllLinks.php index 9324acbc70..61bc90e5f9 100644 --- a/includes/api/ApiQueryAllLinks.php +++ b/includes/api/ApiQueryAllLinks.php @@ -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'; diff --git a/includes/api/ApiQueryAllMessages.php b/includes/api/ApiQueryAllMessages.php index 09f40fd2fa..8d4af0b0f3 100644 --- a/includes/api/ApiQueryAllMessages.php +++ b/includes/api/ApiQueryAllMessages.php @@ -31,7 +31,7 @@ */ class ApiQueryAllMessages extends ApiQueryBase { - public function __construct( $query, $moduleName ) { + public function __construct( ApiQuery $query, $moduleName ) { parent::__construct( $query, $moduleName, 'am' ); } diff --git a/includes/api/ApiQueryAllPages.php b/includes/api/ApiQueryAllPages.php index 4ac948581c..b283177859 100644 --- a/includes/api/ApiQueryAllPages.php +++ b/includes/api/ApiQueryAllPages.php @@ -31,7 +31,7 @@ */ class ApiQueryAllPages extends ApiQueryGeneratorBase { - public function __construct( $query, $moduleName ) { + public function __construct( ApiQuery $query, $moduleName ) { parent::__construct( $query, $moduleName, 'ap' ); } diff --git a/includes/api/ApiQueryAllUsers.php b/includes/api/ApiQueryAllUsers.php index df8db16f00..42464efefb 100644 --- a/includes/api/ApiQueryAllUsers.php +++ b/includes/api/ApiQueryAllUsers.php @@ -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' ); } diff --git a/includes/api/ApiQueryBacklinks.php b/includes/api/ApiQueryBacklinks.php index 524dda40b0..8dc2a6580a 100644 --- a/includes/api/ApiQueryBacklinks.php +++ b/includes/api/ApiQueryBacklinks.php @@ -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']; diff --git a/includes/api/ApiQueryBase.php b/includes/api/ApiQueryBase.php index eac25e6870..01384c0a79 100644 --- a/includes/api/ApiQueryBase.php +++ b/includes/api/ApiQueryBase.php @@ -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(); } diff --git a/includes/api/ApiQueryBlocks.php b/includes/api/ApiQueryBlocks.php index f69b3106ed..7d27a64ca5 100644 --- a/includes/api/ApiQueryBlocks.php +++ b/includes/api/ApiQueryBlocks.php @@ -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' ); } diff --git a/includes/api/ApiQueryCategories.php b/includes/api/ApiQueryCategories.php index 90e8ed7840..cfc76e66fc 100644 --- a/includes/api/ApiQueryCategories.php +++ b/includes/api/ApiQueryCategories.php @@ -31,7 +31,7 @@ */ class ApiQueryCategories extends ApiQueryGeneratorBase { - public function __construct( $query, $moduleName ) { + public function __construct( ApiQuery $query, $moduleName ) { parent::__construct( $query, $moduleName, 'cl' ); } diff --git a/includes/api/ApiQueryCategoryInfo.php b/includes/api/ApiQueryCategoryInfo.php index d0e3a360c9..8097b7bd69 100644 --- a/includes/api/ApiQueryCategoryInfo.php +++ b/includes/api/ApiQueryCategoryInfo.php @@ -32,7 +32,7 @@ */ class ApiQueryCategoryInfo extends ApiQueryBase { - public function __construct( $query, $moduleName ) { + public function __construct( ApiQuery $query, $moduleName ) { parent::__construct( $query, $moduleName, 'ci' ); } diff --git a/includes/api/ApiQueryCategoryMembers.php b/includes/api/ApiQueryCategoryMembers.php index 14c2f816e4..a3bc3b99f7 100644 --- a/includes/api/ApiQueryCategoryMembers.php +++ b/includes/api/ApiQueryCategoryMembers.php @@ -31,7 +31,7 @@ */ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase { - public function __construct( $query, $moduleName ) { + public function __construct( ApiQuery $query, $moduleName ) { parent::__construct( $query, $moduleName, 'cm' ); } diff --git a/includes/api/ApiQueryContributors.php b/includes/api/ApiQueryContributors.php index 912ac0213e..b90283f978 100644 --- a/includes/api/ApiQueryContributors.php +++ b/includes/api/ApiQueryContributors.php @@ -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' ); diff --git a/includes/api/ApiQueryDeletedrevs.php b/includes/api/ApiQueryDeletedrevs.php index 2ca93f55ed..af0d938b56 100644 --- a/includes/api/ApiQueryDeletedrevs.php +++ b/includes/api/ApiQueryDeletedrevs.php @@ -31,7 +31,7 @@ */ class ApiQueryDeletedrevs extends ApiQueryBase { - public function __construct( $query, $moduleName ) { + public function __construct( ApiQuery $query, $moduleName ) { parent::__construct( $query, $moduleName, 'dr' ); } diff --git a/includes/api/ApiQueryDuplicateFiles.php b/includes/api/ApiQueryDuplicateFiles.php index 3105f91abe..46454029fb 100644 --- a/includes/api/ApiQueryDuplicateFiles.php +++ b/includes/api/ApiQueryDuplicateFiles.php @@ -31,7 +31,7 @@ */ class ApiQueryDuplicateFiles extends ApiQueryGeneratorBase { - public function __construct( $query, $moduleName ) { + public function __construct( ApiQuery $query, $moduleName ) { parent::__construct( $query, $moduleName, 'df' ); } diff --git a/includes/api/ApiQueryExtLinksUsage.php b/includes/api/ApiQueryExtLinksUsage.php index da095e6329..070681c299 100644 --- a/includes/api/ApiQueryExtLinksUsage.php +++ b/includes/api/ApiQueryExtLinksUsage.php @@ -29,7 +29,7 @@ */ class ApiQueryExtLinksUsage extends ApiQueryGeneratorBase { - public function __construct( $query, $moduleName ) { + public function __construct( ApiQuery $query, $moduleName ) { parent::__construct( $query, $moduleName, 'eu' ); } diff --git a/includes/api/ApiQueryExternalLinks.php b/includes/api/ApiQueryExternalLinks.php index f7a0958dac..e3a7be3da7 100644 --- a/includes/api/ApiQueryExternalLinks.php +++ b/includes/api/ApiQueryExternalLinks.php @@ -31,7 +31,7 @@ */ class ApiQueryExternalLinks extends ApiQueryBase { - public function __construct( $query, $moduleName ) { + public function __construct( ApiQuery $query, $moduleName ) { parent::__construct( $query, $moduleName, 'el' ); } diff --git a/includes/api/ApiQueryFileRepoInfo.php b/includes/api/ApiQueryFileRepoInfo.php index d9579a1016..d1600efe39 100644 --- a/includes/api/ApiQueryFileRepoInfo.php +++ b/includes/api/ApiQueryFileRepoInfo.php @@ -29,7 +29,7 @@ */ class ApiQueryFileRepoInfo extends ApiQueryBase { - public function __construct( $query, $moduleName ) { + public function __construct( ApiQuery $query, $moduleName ) { parent::__construct( $query, $moduleName, 'fri' ); } diff --git a/includes/api/ApiQueryFilearchive.php b/includes/api/ApiQueryFilearchive.php index e12d927752..97918e3c59 100644 --- a/includes/api/ApiQueryFilearchive.php +++ b/includes/api/ApiQueryFilearchive.php @@ -33,7 +33,7 @@ */ class ApiQueryFilearchive extends ApiQueryBase { - public function __construct( $query, $moduleName ) { + public function __construct( ApiQuery $query, $moduleName ) { parent::__construct( $query, $moduleName, 'fa' ); } diff --git a/includes/api/ApiQueryIWBacklinks.php b/includes/api/ApiQueryIWBacklinks.php index ec5453c2ef..35b2b4092b 100644 --- a/includes/api/ApiQueryIWBacklinks.php +++ b/includes/api/ApiQueryIWBacklinks.php @@ -31,7 +31,7 @@ */ class ApiQueryIWBacklinks extends ApiQueryGeneratorBase { - public function __construct( $query, $moduleName ) { + public function __construct( ApiQuery $query, $moduleName ) { parent::__construct( $query, $moduleName, 'iwbl' ); } diff --git a/includes/api/ApiQueryIWLinks.php b/includes/api/ApiQueryIWLinks.php index a7b69a0dd3..f38a7b17ed 100644 --- a/includes/api/ApiQueryIWLinks.php +++ b/includes/api/ApiQueryIWLinks.php @@ -32,7 +32,7 @@ */ class ApiQueryIWLinks extends ApiQueryBase { - public function __construct( $query, $moduleName ) { + public function __construct( ApiQuery $query, $moduleName ) { parent::__construct( $query, $moduleName, 'iw' ); } diff --git a/includes/api/ApiQueryImageInfo.php b/includes/api/ApiQueryImageInfo.php index 5c410a4fd2..5a82f19963 100644 --- a/includes/api/ApiQueryImageInfo.php +++ b/includes/api/ApiQueryImageInfo.php @@ -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 diff --git a/includes/api/ApiQueryImages.php b/includes/api/ApiQueryImages.php index 032050ebf7..87b07782c0 100644 --- a/includes/api/ApiQueryImages.php +++ b/includes/api/ApiQueryImages.php @@ -32,7 +32,7 @@ */ class ApiQueryImages extends ApiQueryGeneratorBase { - public function __construct( $query, $moduleName ) { + public function __construct( ApiQuery $query, $moduleName ) { parent::__construct( $query, $moduleName, 'im' ); } diff --git a/includes/api/ApiQueryInfo.php b/includes/api/ApiQueryInfo.php index 7a702998fd..f160791347 100644 --- a/includes/api/ApiQueryInfo.php +++ b/includes/api/ApiQueryInfo.php @@ -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' ); } diff --git a/includes/api/ApiQueryLangBacklinks.php b/includes/api/ApiQueryLangBacklinks.php index 5f286549eb..13711e6c83 100644 --- a/includes/api/ApiQueryLangBacklinks.php +++ b/includes/api/ApiQueryLangBacklinks.php @@ -31,7 +31,7 @@ */ class ApiQueryLangBacklinks extends ApiQueryGeneratorBase { - public function __construct( $query, $moduleName ) { + public function __construct( ApiQuery $query, $moduleName ) { parent::__construct( $query, $moduleName, 'lbl' ); } diff --git a/includes/api/ApiQueryLangLinks.php b/includes/api/ApiQueryLangLinks.php index 8e155f2816..53cfba1ec8 100644 --- a/includes/api/ApiQueryLangLinks.php +++ b/includes/api/ApiQueryLangLinks.php @@ -31,7 +31,7 @@ */ class ApiQueryLangLinks extends ApiQueryBase { - public function __construct( $query, $moduleName ) { + public function __construct( ApiQuery $query, $moduleName ) { parent::__construct( $query, $moduleName, 'll' ); } diff --git a/includes/api/ApiQueryLinks.php b/includes/api/ApiQueryLinks.php index dd816cfee5..7c17938193 100644 --- a/includes/api/ApiQueryLinks.php +++ b/includes/api/ApiQueryLinks.php @@ -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'; diff --git a/includes/api/ApiQueryLogEvents.php b/includes/api/ApiQueryLogEvents.php index 7062570fe1..bb424ee458 100644 --- a/includes/api/ApiQueryLogEvents.php +++ b/includes/api/ApiQueryLogEvents.php @@ -31,7 +31,7 @@ */ class ApiQueryLogEvents extends ApiQueryBase { - public function __construct( $query, $moduleName ) { + public function __construct( ApiQuery $query, $moduleName ) { parent::__construct( $query, $moduleName, 'le' ); } diff --git a/includes/api/ApiQueryPagePropNames.php b/includes/api/ApiQueryPagePropNames.php index c38747546b..8cd9c6cffa 100644 --- a/includes/api/ApiQueryPagePropNames.php +++ b/includes/api/ApiQueryPagePropNames.php @@ -32,7 +32,7 @@ */ class ApiQueryPagePropNames extends ApiQueryBase { - public function __construct( $query, $moduleName ) { + public function __construct( ApiQuery $query, $moduleName ) { parent::__construct( $query, $moduleName, 'ppn' ); } diff --git a/includes/api/ApiQueryPageProps.php b/includes/api/ApiQueryPageProps.php index b68a385231..e370c39f42 100644 --- a/includes/api/ApiQueryPageProps.php +++ b/includes/api/ApiQueryPageProps.php @@ -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' ); } diff --git a/includes/api/ApiQueryPagesWithProp.php b/includes/api/ApiQueryPagesWithProp.php index 4381485638..b6c8525388 100644 --- a/includes/api/ApiQueryPagesWithProp.php +++ b/includes/api/ApiQueryPagesWithProp.php @@ -32,7 +32,7 @@ */ class ApiQueryPagesWithProp extends ApiQueryGeneratorBase { - public function __construct( $query, $moduleName ) { + public function __construct( ApiQuery $query, $moduleName ) { parent::__construct( $query, $moduleName, 'pwp' ); } diff --git a/includes/api/ApiQueryProtectedTitles.php b/includes/api/ApiQueryProtectedTitles.php index 368705d7a7..8f120c60fe 100644 --- a/includes/api/ApiQueryProtectedTitles.php +++ b/includes/api/ApiQueryProtectedTitles.php @@ -31,7 +31,7 @@ */ class ApiQueryProtectedTitles extends ApiQueryGeneratorBase { - public function __construct( $query, $moduleName ) { + public function __construct( ApiQuery $query, $moduleName ) { parent::__construct( $query, $moduleName, 'pt' ); } diff --git a/includes/api/ApiQueryQueryPage.php b/includes/api/ApiQueryQueryPage.php index 8ddc48a77f..45950e79e5 100644 --- a/includes/api/ApiQueryQueryPage.php +++ b/includes/api/ApiQueryQueryPage.php @@ -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; diff --git a/includes/api/ApiQueryRandom.php b/includes/api/ApiQueryRandom.php index a27edcfcd8..07f8a0e405 100644 --- a/includes/api/ApiQueryRandom.php +++ b/includes/api/ApiQueryRandom.php @@ -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' ); } diff --git a/includes/api/ApiQueryRecentChanges.php b/includes/api/ApiQueryRecentChanges.php index f962ba01f0..c0c10b9332 100644 --- a/includes/api/ApiQueryRecentChanges.php +++ b/includes/api/ApiQueryRecentChanges.php @@ -32,7 +32,7 @@ */ class ApiQueryRecentChanges extends ApiQueryGeneratorBase { - public function __construct( $query, $moduleName ) { + public function __construct( ApiQuery $query, $moduleName ) { parent::__construct( $query, $moduleName, 'rc' ); } diff --git a/includes/api/ApiQueryRedirects.php b/includes/api/ApiQueryRedirects.php index 2ed7d30f90..afb2c5618f 100644 --- a/includes/api/ApiQueryRedirects.php +++ b/includes/api/ApiQueryRedirects.php @@ -32,7 +32,7 @@ */ class ApiQueryRedirects extends ApiQueryGeneratorBase { - public function __construct( $query, $moduleName ) { + public function __construct( ApiQuery $query, $moduleName ) { parent::__construct( $query, $moduleName, 'rd' ); } diff --git a/includes/api/ApiQueryRevisions.php b/includes/api/ApiQueryRevisions.php index 61509953b6..592c434d56 100644 --- a/includes/api/ApiQueryRevisions.php +++ b/includes/api/ApiQueryRevisions.php @@ -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' ); } diff --git a/includes/api/ApiQuerySearch.php b/includes/api/ApiQuerySearch.php index 8eceb6f084..d67fac2a9c 100644 --- a/includes/api/ApiQuerySearch.php +++ b/includes/api/ApiQuerySearch.php @@ -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' ); } diff --git a/includes/api/ApiQuerySiteinfo.php b/includes/api/ApiQuerySiteinfo.php index 2124dc32d1..ea3a0843dd 100644 --- a/includes/api/ApiQuerySiteinfo.php +++ b/includes/api/ApiQuerySiteinfo.php @@ -31,7 +31,7 @@ */ class ApiQuerySiteinfo extends ApiQueryBase { - public function __construct( $query, $moduleName ) { + public function __construct( ApiQuery $query, $moduleName ) { parent::__construct( $query, $moduleName, 'si' ); } diff --git a/includes/api/ApiQueryStashImageInfo.php b/includes/api/ApiQueryStashImageInfo.php index c870835f7b..d9409ec46e 100644 --- a/includes/api/ApiQueryStashImageInfo.php +++ b/includes/api/ApiQueryStashImageInfo.php @@ -27,7 +27,7 @@ */ class ApiQueryStashImageInfo extends ApiQueryImageInfo { - public function __construct( $query, $moduleName ) { + public function __construct( ApiQuery $query, $moduleName ) { parent::__construct( $query, $moduleName, 'sii' ); } diff --git a/includes/api/ApiQueryTags.php b/includes/api/ApiQueryTags.php index 9e2559f029..77c105aeda 100644 --- a/includes/api/ApiQueryTags.php +++ b/includes/api/ApiQueryTags.php @@ -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' ); } diff --git a/includes/api/ApiQueryUserContributions.php b/includes/api/ApiQueryUserContributions.php index 780b2fa7a1..568ccb505c 100644 --- a/includes/api/ApiQueryUserContributions.php +++ b/includes/api/ApiQueryUserContributions.php @@ -31,7 +31,7 @@ */ class ApiQueryContributions extends ApiQueryBase { - public function __construct( $query, $moduleName ) { + public function __construct( ApiQuery $query, $moduleName ) { parent::__construct( $query, $moduleName, 'uc' ); } diff --git a/includes/api/ApiQueryUserInfo.php b/includes/api/ApiQueryUserInfo.php index 200b03bcee..ee5e458076 100644 --- a/includes/api/ApiQueryUserInfo.php +++ b/includes/api/ApiQueryUserInfo.php @@ -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' ); } diff --git a/includes/api/ApiQueryUsers.php b/includes/api/ApiQueryUsers.php index ce92063c5c..d0d0f08223 100644 --- a/includes/api/ApiQueryUsers.php +++ b/includes/api/ApiQueryUsers.php @@ -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' ); } diff --git a/includes/api/ApiQueryWatchlist.php b/includes/api/ApiQueryWatchlist.php index 869faea7a4..b198883a5e 100644 --- a/includes/api/ApiQueryWatchlist.php +++ b/includes/api/ApiQueryWatchlist.php @@ -32,7 +32,7 @@ */ class ApiQueryWatchlist extends ApiQueryGeneratorBase { - public function __construct( $query, $moduleName ) { + public function __construct( ApiQuery $query, $moduleName ) { parent::__construct( $query, $moduleName, 'wl' ); } diff --git a/includes/api/ApiQueryWatchlistRaw.php b/includes/api/ApiQueryWatchlistRaw.php index 07efb52c2f..6aae6dc33f 100644 --- a/includes/api/ApiQueryWatchlistRaw.php +++ b/includes/api/ApiQueryWatchlistRaw.php @@ -32,7 +32,7 @@ */ class ApiQueryWatchlistRaw extends ApiQueryGeneratorBase { - public function __construct( $query, $moduleName ) { + public function __construct( ApiQuery $query, $moduleName ) { parent::__construct( $query, $moduleName, 'wr' ); } diff --git a/includes/api/ApiResult.php b/includes/api/ApiResult.php index c729238fbc..c351561cd8 100644 --- a/includes/api/ApiResult.php +++ b/includes/api/ApiResult.php @@ -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; diff --git a/includes/api/ApiRsd.php b/includes/api/ApiRsd.php index 7a0f0c6332..a2771a0c4f 100644 --- a/includes/api/ApiRsd.php +++ b/includes/api/ApiRsd.php @@ -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' ); } diff --git a/tests/phpunit/includes/api/PrefixUniquenessTest.php b/tests/phpunit/includes/api/PrefixUniquenessTest.php index a1fc2c296e..38beb87208 100644 --- a/tests/phpunit/includes/api/PrefixUniquenessTest.php +++ b/tests/phpunit/includes/api/PrefixUniquenessTest.php @@ -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]}" ); -- 2.20.1