diff options
author | Umherirrender <umherirrender_de.wp@web.de> | 2025-03-30 20:31:38 +0200 |
---|---|---|
committer | Umherirrender <umherirrender_de.wp@web.de> | 2025-04-04 00:36:42 +0000 |
commit | b160a8dd0284d5212eba022db2587d9811088e9d (patch) | |
tree | 18bed6523bac77651e65d6e63f2cb5ac241f1110 | |
parent | d0fd2b39add6658f6e2d63249e3f5096c10b4052 (diff) | |
download | mediawikicore-b160a8dd0284d5212eba022db2587d9811088e9d.tar.gz mediawikicore-b160a8dd0284d5212eba022db2587d9811088e9d.zip |
specials: Use type declaration on undocumented private functions
Change-Id: Ib394792b10afabf5e0440cd3be34c1f2fd9cfe1d
22 files changed, 35 insertions, 31 deletions
diff --git a/includes/specials/SpecialBotPasswords.php b/includes/specials/SpecialBotPasswords.php index e660e09b0dd2..89c33301f0b1 100644 --- a/includes/specials/SpecialBotPasswords.php +++ b/includes/specials/SpecialBotPasswords.php @@ -347,7 +347,7 @@ class SpecialBotPasswords extends FormSpecialPage { return false; } - private function save( array $data ) { + private function save( array $data ): Status { $bp = BotPassword::newUnsaved( [ 'centralId' => $this->userId, 'appId' => $this->par, diff --git a/includes/specials/SpecialComparePages.php b/includes/specials/SpecialComparePages.php index dac7d2be5f94..241dea83c156 100644 --- a/includes/specials/SpecialComparePages.php +++ b/includes/specials/SpecialComparePages.php @@ -146,7 +146,7 @@ class SpecialComparePages extends SpecialPage { } } - private function revOrTitle( $revision, $title ) { + private function revOrTitle( ?int $revision, ?string $title ): ?int { if ( $revision ) { return $revision; } elseif ( $title ) { diff --git a/includes/specials/SpecialDoubleRedirects.php b/includes/specials/SpecialDoubleRedirects.php index 88e548a9e967..0cbbfb371be8 100644 --- a/includes/specials/SpecialDoubleRedirects.php +++ b/includes/specials/SpecialDoubleRedirects.php @@ -71,7 +71,7 @@ class SpecialDoubleRedirects extends QueryPage { return $this->msg( 'doubleredirectstext' )->parseAsBlock(); } - private function reallyGetQueryInfo( $namespace = null, $title = null ) { + private function reallyGetQueryInfo( ?int $namespace = null, ?string $title = null ): array { $limitToTitle = !( $namespace === null && $title === null ); $retval = [ 'tables' => [ diff --git a/includes/specials/SpecialImport.php b/includes/specials/SpecialImport.php index 526c4ade508a..cdfd5dd707a9 100644 --- a/includes/specials/SpecialImport.php +++ b/includes/specials/SpecialImport.php @@ -276,7 +276,7 @@ class SpecialImport extends SpecialPage { } } - private function getMappingFormPart( $sourceName ) { + private function getMappingFormPart( string $sourceName ): array { $defaultNamespace = $this->getConfig()->get( MainConfigNames::ImportTargetNamespace ); return [ 'mapping' => [ diff --git a/includes/specials/SpecialLinkSearch.php b/includes/specials/SpecialLinkSearch.php index 450c72d30f23..48e34d52cb10 100644 --- a/includes/specials/SpecialLinkSearch.php +++ b/includes/specials/SpecialLinkSearch.php @@ -54,7 +54,7 @@ class SpecialLinkSearch extends QueryPage { private UrlUtils $urlUtils; - private function setParams( $params ) { + private function setParams( array $params ) { $this->mQuery = $params['query']; $this->mNs = $params['namespace']; $this->mProt = $params['protocol']; diff --git a/includes/specials/SpecialLog.php b/includes/specials/SpecialLog.php index c4b1cdd800ea..fd7298bea7e3 100644 --- a/includes/specials/SpecialLog.php +++ b/includes/specials/SpecialLog.php @@ -321,7 +321,7 @@ class SpecialLog extends SpecialPage { } } - private function getActionButtons( $formcontents ) { + private function getActionButtons( string $formcontents ): string { $canRevDelete = $this->getAuthority() ->isAllowedAll( 'deletedhistory', 'deletelogentry' ); $showTagEditUI = ChangeTags::showTagEditingUI( $this->getAuthority() ); diff --git a/includes/specials/SpecialMovePage.php b/includes/specials/SpecialMovePage.php index 94e44f0d61e9..2a4000ab2754 100644 --- a/includes/specials/SpecialMovePage.php +++ b/includes/specials/SpecialMovePage.php @@ -964,7 +964,7 @@ class SpecialMovePage extends UnlistedSpecialPage { $this->watchlistManager->setWatch( $this->watch, $this->getAuthority(), $nt ); } - private function showLogFragment( $title ) { + private function showLogFragment( Title $title ) { $moveLogPage = new LogPage( 'move' ); $out = $this->getOutput(); $out->addHTML( Xml::element( 'h2', null, $moveLogPage->getName()->text() ) ); @@ -1010,7 +1010,9 @@ class SpecialMovePage extends UnlistedSpecialPage { } } - private function showSubpagesList( $subpages, $pagecount, $msg, $truncatedMsg, $noSubpageMsg = false ) { + private function showSubpagesList( + TitleArrayFromResult $subpages, int $pagecount, string $msg, string $truncatedMsg, bool $noSubpageMsg = false + ) { $out = $this->getOutput(); # No subpages. diff --git a/includes/specials/SpecialNewPages.php b/includes/specials/SpecialNewPages.php index 0569d9752df7..eb2fdedb34cb 100644 --- a/includes/specials/SpecialNewPages.php +++ b/includes/specials/SpecialNewPages.php @@ -380,7 +380,7 @@ class SpecialNewPages extends IncludableSpecialPage { $out->addModuleStyles( 'mediawiki.special' ); } - private function getNewPagesPager() { + private function getNewPagesPager(): NewPagesPager { return new NewPagesPager( $this->getContext(), $this->getLinkRenderer(), diff --git a/includes/specials/SpecialPageLanguage.php b/includes/specials/SpecialPageLanguage.php index 0272f2c34ce5..57f3d58a284d 100644 --- a/includes/specials/SpecialPageLanguage.php +++ b/includes/specials/SpecialPageLanguage.php @@ -308,7 +308,7 @@ class SpecialPageLanguage extends FormSpecialPage { $this->getOutput()->redirect( $this->goToUrl ); } - private function showLogFragment( $title ) { + private function showLogFragment( string $title ): string { $moveLogPage = new LogPage( 'pagelang' ); $out1 = Xml::element( 'h2', null, $moveLogPage->getName()->text() ); $out2 = ''; diff --git a/includes/specials/SpecialRandomPage.php b/includes/specials/SpecialRandomPage.php index 29babcfd45aa..c4049c8380a5 100644 --- a/includes/specials/SpecialRandomPage.php +++ b/includes/specials/SpecialRandomPage.php @@ -61,7 +61,7 @@ class SpecialRandomPage extends SpecialPage { $this->namespaces = [ $ns ]; } - private function isValidNS( $ns ) { + private function isValidNS( $ns ): bool { return $ns !== false && $ns >= 0; } @@ -208,7 +208,7 @@ class SpecialRandomPage extends SpecialPage { ]; } - private function selectRandomPageFromDB( $randstr, $fname ) { + private function selectRandomPageFromDB( $randstr, string $fname ) { $dbr = $this->dbProvider->getReplicaDatabase(); $query = $this->getQueryInfo( $randstr ); diff --git a/includes/specials/SpecialRenameUser.php b/includes/specials/SpecialRenameUser.php index 040f19055861..a048d621f797 100644 --- a/includes/specials/SpecialRenameUser.php +++ b/includes/specials/SpecialRenameUser.php @@ -251,7 +251,7 @@ class SpecialRenameUser extends SpecialPage { } } - private function getWarnings( $oldName, $newName ) { + private function getWarnings( string $oldName, string $newName ): array { $warnings = []; $oldUser = $this->userFactory->newFromName( $oldName, $this->userFactory::RIGOR_NONE ); if ( $oldUser && !$oldUser->isTemp() && $oldUser->getBlock() ) { @@ -264,7 +264,9 @@ class SpecialRenameUser extends SpecialPage { return $warnings; } - private function showForm( $oldName, $newName, $warnings, $reason, $moveChecked, $suppressChecked ) { + private function showForm( + ?string $oldName, ?string $newName, array $warnings, string $reason, bool $moveChecked, bool $suppressChecked + ) { $performer = $this->getUser(); $formDescriptor = [ diff --git a/includes/specials/SpecialSpecialPages.php b/includes/specials/SpecialSpecialPages.php index f41939a4e625..68240ac1d3a6 100644 --- a/includes/specials/SpecialSpecialPages.php +++ b/includes/specials/SpecialSpecialPages.php @@ -97,7 +97,7 @@ class SpecialSpecialPages extends UnlistedSpecialPage { return $groups; } - private function outputPageList( $groups ) { + private function outputPageList( array $groups ) { $out = $this->getOutput(); // Legend diff --git a/includes/specials/SpecialStatistics.php b/includes/specials/SpecialStatistics.php index 9efc01638d93..5ce81a8f2bd5 100644 --- a/includes/specials/SpecialStatistics.php +++ b/includes/specials/SpecialStatistics.php @@ -168,7 +168,7 @@ class SpecialStatistics extends SpecialPage { return $pageStatsHtml; } - private function getEditStats() { + private function getEditStats(): string { return Html::rawElement( 'tr', [], Xml::tags( 'th', [ 'colspan' => '2' ], $this->msg( 'statistics-header-edits' )->parse() @@ -184,7 +184,7 @@ class SpecialStatistics extends SpecialPage { ); } - private function getUserStats() { + private function getUserStats(): string { return Html::rawElement( 'tr', [], Xml::tags( 'th', [ 'colspan' => '2' ], $this->msg( 'statistics-header-users' )->parse() @@ -210,7 +210,7 @@ class SpecialStatistics extends SpecialPage { ); } - private function getGroupStats() { + private function getGroupStats(): string { $linkRenderer = $this->getLinkRenderer(); $lang = $this->getLanguage(); $text = ''; diff --git a/includes/specials/SpecialTags.php b/includes/specials/SpecialTags.php index 625c82b97b79..159f02d5f9cf 100644 --- a/includes/specials/SpecialTags.php +++ b/includes/specials/SpecialTags.php @@ -193,8 +193,8 @@ class SpecialTags extends SpecialPage { } private function doTagRow( - $tag, $hitcount, $showManageActions, $showDeleteActions, $showEditLinks - ) { + string $tag, int $hitcount, bool $showManageActions, bool $showDeleteActions, bool $showEditLinks + ): string { $newRow = ''; $newRow .= Xml::tags( 'td', null, Xml::element( 'code', null, $tag ) ); diff --git a/includes/specials/SpecialUndelete.php b/includes/specials/SpecialUndelete.php index 930c03e39944..e3486316e8ce 100644 --- a/includes/specials/SpecialUndelete.php +++ b/includes/specials/SpecialUndelete.php @@ -198,7 +198,7 @@ class SpecialUndelete extends SpecialPage { return true; } - private function loadRequest( $par ) { + private function loadRequest( ?string $par ) { $request = $this->getRequest(); $user = $this->getUser(); @@ -551,7 +551,7 @@ class SpecialUndelete extends SpecialPage { return true; } - private function showRevision( $timestamp ) { + private function showRevision( string $timestamp ) { if ( !preg_match( '/[0-9]{14}/', $timestamp ) ) { return; } @@ -1416,7 +1416,7 @@ class SpecialUndelete extends SpecialPage { return Xml::tags( 'li', $attribs, $revisionRow ) . "\n"; } - private function formatFileRow( $row ) { + private function formatFileRow( \stdClass $row ): string { $file = ArchivedFile::newFromRow( $row ); $ts = wfTimestamp( TS_MW, $row->fa_timestamp ); $user = $this->getUser(); diff --git a/includes/specials/SpecialUserRights.php b/includes/specials/SpecialUserRights.php index 79018cd27eb0..0fa6b38273be 100644 --- a/includes/specials/SpecialUserRights.php +++ b/includes/specials/SpecialUserRights.php @@ -291,7 +291,7 @@ class SpecialUserRights extends SpecialPage { } } - private function getSuccessURL() { + private function getSuccessURL(): string { return $this->getPageTitle( $this->mTarget )->getFullURL(); } diff --git a/includes/specials/SpecialVersion.php b/includes/specials/SpecialVersion.php index 6541721995e0..8584e96567dc 100644 --- a/includes/specials/SpecialVersion.php +++ b/includes/specials/SpecialVersion.php @@ -1227,7 +1227,7 @@ class SpecialVersion extends SpecialPage { return implode( "\n", $ret ); } - private function openExtType( ?string $text = null, ?string $name = null ) { + private function openExtType( ?string $text = null, ?string $name = null ): string { $out = ''; $opt = [ 'class' => 'wikitable plainlinks mw-installed-software' ]; diff --git a/includes/specials/SpecialWatchlist.php b/includes/specials/SpecialWatchlist.php index 654e545d191e..4b4eb716770b 100644 --- a/includes/specials/SpecialWatchlist.php +++ b/includes/specials/SpecialWatchlist.php @@ -849,7 +849,7 @@ class SpecialWatchlist extends ChangesListSpecialPage { $this->setBottomText( $opts ); } - private function cutoffselector( $options ) { + private function cutoffselector( FormOptions $options ): string { $selected = (float)$options['days']; $maxDays = $this->getConfig()->get( MainConfigNames::RCMaxAge ) / ( 3600 * 24 ); if ( $selected <= 0 ) { diff --git a/includes/specials/SpecialWhatLinksHere.php b/includes/specials/SpecialWhatLinksHere.php index 81c95775248b..e2203c993e18 100644 --- a/includes/specials/SpecialWhatLinksHere.php +++ b/includes/specials/SpecialWhatLinksHere.php @@ -493,7 +493,7 @@ class SpecialWhatLinksHere extends FormSpecialPage { return Xml::openElement( 'ul', ( $level ? [] : [ 'id' => 'mw-whatlinkshere-list' ] ) ); } - private function listItem( stdClass $row, PageIdentity $nt, LinkTarget $target, bool $notClose = false ) { + private function listItem( stdClass $row, PageIdentity $nt, LinkTarget $target, bool $notClose = false ): string { $legacyTitle = $this->titleFactory->newFromPageIdentity( $nt ); if ( $row->rd_from || $row->page_is_redirect ) { @@ -594,7 +594,7 @@ class SpecialWhatLinksHere extends FormSpecialPage { return $this->getLanguage()->pipeList( $links ); } - private function getPrevNext( $prevNamespace, $prevPageId, $nextNamespace, $nextPageId ) { + private function getPrevNext( $prevNamespace, $prevPageId, $nextNamespace, $nextPageId ): string { $navBuilder = new PagerNavigationBuilder( $this->getContext() ); $navBuilder diff --git a/includes/specials/forms/PreferencesFormOOUI.php b/includes/specials/forms/PreferencesFormOOUI.php index 6ddf2793d288..e9642a18f263 100644 --- a/includes/specials/forms/PreferencesFormOOUI.php +++ b/includes/specials/forms/PreferencesFormOOUI.php @@ -141,7 +141,7 @@ class PreferencesFormOOUI extends OOUIHTMLForm { return $layout; } - private function isMobileLayout() { + private function isMobileLayout(): bool { if ( $this->useMobileLayout === null ) { $skin = $this->getSkin(); $this->useMobileLayout = false; diff --git a/includes/specials/pagers/AllMessagesTablePager.php b/includes/specials/pagers/AllMessagesTablePager.php index c06fdf99443e..01d9626f2b93 100644 --- a/includes/specials/pagers/AllMessagesTablePager.php +++ b/includes/specials/pagers/AllMessagesTablePager.php @@ -124,7 +124,7 @@ class AllMessagesTablePager extends TablePager { } } - private function getAllMessages( $descending ) { + private function getAllMessages( bool $descending ): array { $messageNames = $this->localisationCache->getSubitemList( 'en', 'messages' ); // Normalise message names so they look like page titles and sort correctly - T86139 diff --git a/includes/specials/pagers/ImageListPager.php b/includes/specials/pagers/ImageListPager.php index 0830e316e89e..7e78f7087bfc 100644 --- a/includes/specials/pagers/ImageListPager.php +++ b/includes/specials/pagers/ImageListPager.php @@ -190,7 +190,7 @@ class ImageListPager extends TablePager { return $conds + $this->mQueryConds; } - private function buildQueryConds() { + private function buildQueryConds(): array { $conds = [ 'file_deleted' => 0, 'fr_deleted' => 0, |