Page MenuHomePhorge

No OneTemporary

Size
27 KB
Referenced Files
None
Subscribers
None
diff --git a/maintenance/CodeCleanerGlobalsPass.php b/maintenance/CodeCleanerGlobalsPass.php
index 7183e0d192d..d8a00788008 100644
--- a/maintenance/CodeCleanerGlobalsPass.php
+++ b/maintenance/CodeCleanerGlobalsPass.php
@@ -39,7 +39,7 @@ class CodeCleanerGlobalsPass extends \Psy\CodeCleaner\CodeCleanerPass {
'GLOBALS', '_SERVER', '_ENV', '_FILES', '_COOKIE', '_POST', '_GET', '_SESSION'
];
- public function beforeTraverse( array $nodes ) {
+ public function beforeTraverse( array $nodes ): array {
$globalVars = array_diff( array_keys( $GLOBALS ), self::SUPERGLOBALS );
$validGlobalVars = array_filter( $globalVars, static function ( string $name ) {
// https://www.php.net/manual/en/language.variables.basics.php
diff --git a/maintenance/TableCleanup.php b/maintenance/TableCleanup.php
index c0ebdd5997e..33938422032 100644
--- a/maintenance/TableCleanup.php
+++ b/maintenance/TableCleanup.php
@@ -74,7 +74,7 @@ class TableCleanup extends Maintenance {
$this->runTable( $this->defaultParams );
}
- protected function init( $count, $table ) {
+ protected function init( int $count, string $table ) {
$this->processed = 0;
$this->updated = 0;
$this->count = $count;
diff --git a/maintenance/benchmarks/benchmarkTitleValue.php b/maintenance/benchmarks/benchmarkTitleValue.php
index 97dfdf27841..198de85d7c9 100644
--- a/maintenance/benchmarks/benchmarkTitleValue.php
+++ b/maintenance/benchmarks/benchmarkTitleValue.php
@@ -115,24 +115,24 @@ class BenchmarkTitleValue extends Benchmarker {
$this->dbKey = ucfirst( wfRandomString( 10 ) );
}
- protected function constructTitleValue() {
+ protected function constructTitleValue(): TitleValue {
return new TitleValue( NS_CATEGORY, $this->dbKey );
}
- protected function constructTitle() {
+ protected function constructTitle(): Title {
return Title::makeTitle( NS_CATEGORY, $this->dbKey );
}
- protected function constructTitleSafe() {
+ protected function constructTitleSafe(): Title {
return Title::makeTitleSafe( NS_CATEGORY, $this->dbKey );
}
- protected function getPrefixedTextTitleValue() {
+ protected function getPrefixedTextTitleValue(): string {
// This is really showing TitleFormatter perf
return $this->titleFormatter->getPrefixedText( $this->titleValue );
}
- protected function getPrefixedTextTitle() {
+ protected function getPrefixedTextTitle(): string {
return $this->title->getPrefixedText();
}
diff --git a/maintenance/cleanupCaps.php b/maintenance/cleanupCaps.php
index 0031d7a5971..5777d9d702e 100644
--- a/maintenance/cleanupCaps.php
+++ b/maintenance/cleanupCaps.php
@@ -80,7 +80,7 @@ class CleanupCaps extends TableCleanup {
'callback' => $callback ] );
}
- protected function processRowToUppercase( $row ) {
+ protected function processRowToUppercase( \stdClass $row ) {
$current = Title::makeTitle( $row->page_namespace, $row->page_title );
// Set the ID of the page because Title::exists will return false
// unless the Article ID is already known, because Title::canExist will be false
@@ -135,7 +135,7 @@ class CleanupCaps extends TableCleanup {
}
}
- protected function processRowToLowercase( $row ) {
+ protected function processRowToLowercase( \stdClass $row ) {
$current = Title::makeTitle( $row->page_namespace, $row->page_title );
$display = $current->getPrefixedText();
$upper = $row->page_title;
diff --git a/maintenance/cleanupImages.php b/maintenance/cleanupImages.php
index 0cea2a570cd..055f7d0821e 100644
--- a/maintenance/cleanupImages.php
+++ b/maintenance/cleanupImages.php
@@ -56,7 +56,7 @@ class CleanupImages extends TableCleanup {
$this->addDescription( 'Script to clean up broken, unparseable upload filenames' );
}
- protected function processRow( $row ) {
+ protected function processRow( \stdClass $row ) {
$source = $row->img_name;
if ( $source == '' ) {
// Ye olde empty rows. Just kill them.
diff --git a/maintenance/cleanupWatchlist.php b/maintenance/cleanupWatchlist.php
index f9a9dba53e6..403ece8974b 100644
--- a/maintenance/cleanupWatchlist.php
+++ b/maintenance/cleanupWatchlist.php
@@ -63,7 +63,7 @@ class CleanupWatchlist extends TableCleanup {
parent::execute();
}
- protected function processRow( $row ) {
+ protected function processRow( \stdClass $row ) {
$current = Title::makeTitle( $row->wl_namespace, $row->wl_title );
$display = $current->getPrefixedText();
$verified = $this->getServiceContainer()->getContentLanguage()->normalize( $display );
diff --git a/maintenance/convertExtensionToRegistration.php b/maintenance/convertExtensionToRegistration.php
index bed732a5092..a40b96a684b 100644
--- a/maintenance/convertExtensionToRegistration.php
+++ b/maintenance/convertExtensionToRegistration.php
@@ -66,7 +66,7 @@ class ConvertExtensionToRegistration extends Maintenance {
$this->addOption( 'config-prefix', 'Custom prefix for configuration settings', false, true );
}
- protected function getAllGlobals() {
+ protected function getAllGlobals(): array {
$processor = new ReflectionClass( ExtensionProcessor::class );
$settings = $processor->getProperty( 'globalSettings' );
$settings->setAccessible( true );
@@ -186,7 +186,7 @@ class ConvertExtensionToRegistration extends Maintenance {
}
}
- protected function handleExtensionFunctions( $realName, $value ) {
+ protected function handleExtensionFunctions( string $realName, array $value ) {
foreach ( $value as $func ) {
if ( $func instanceof Closure ) {
$this->fatalError( "Error: Closures cannot be converted to JSON. " .
@@ -203,7 +203,7 @@ class ConvertExtensionToRegistration extends Maintenance {
$this->json[$realName] = $value;
}
- protected function handleMessagesDirs( $realName, $value, $_ ) {
+ protected function handleMessagesDirs( string $realName, array $value, array $_ ) {
foreach ( $value as $key => $dirs ) {
foreach ( (array)$dirs as $dir ) {
$this->json[$realName][$key][] = $this->stripPath( $dir, $this->dir );
@@ -211,7 +211,7 @@ class ConvertExtensionToRegistration extends Maintenance {
}
}
- protected function handleExtensionMessagesFiles( $realName, $value, $vars ) {
+ protected function handleExtensionMessagesFiles( string $realName, array $value, array $vars ) {
foreach ( $value as $key => $file ) {
$strippedFile = $this->stripPath( $file, $this->dir );
if ( isset( $vars['wgMessagesDirs'][$key] ) ) {
@@ -237,7 +237,7 @@ class ConvertExtensionToRegistration extends Maintenance {
return $val;
}
- protected function removeAbsolutePath( $realName, $value ) {
+ protected function removeAbsolutePath( string $realName, array $value ) {
$out = [];
foreach ( $value as $key => $val ) {
$out[$key] = $this->stripPath( $val, $this->dir );
@@ -245,7 +245,7 @@ class ConvertExtensionToRegistration extends Maintenance {
$this->json[$realName] = $out;
}
- protected function removeAutodiscoveredParserTestFiles( $realName, $value ) {
+ protected function removeAutodiscoveredParserTestFiles( string $realName, array $value ) {
$out = [];
foreach ( $value as $key => $val ) {
$path = $this->stripPath( $val, $this->dir );
@@ -266,7 +266,7 @@ class ConvertExtensionToRegistration extends Maintenance {
// with a ParserTestFiles key that will no longer validate.
}
- protected function handleCredits( $realName, $value ) {
+ protected function handleCredits( string $realName, array $value ) {
$keys = array_keys( $value );
$this->json['type'] = $keys[0];
$values = array_values( $value );
@@ -277,7 +277,7 @@ class ConvertExtensionToRegistration extends Maintenance {
}
}
- public function handleHooks( $realName, $value ) {
+ public function handleHooks( string $realName, array $value ) {
foreach ( $value as $hookName => &$handlers ) {
if ( $hookName === 'UnitTestsList' ) {
$this->output( "Note: the UnitTestsList hook is no longer necessary as " .
@@ -341,7 +341,7 @@ class ConvertExtensionToRegistration extends Maintenance {
}
}
- protected function needsComposerAutoloader( $path ) {
+ protected function needsComposerAutoloader( string $path ): bool {
$path .= '/composer.json';
if ( file_exists( $path ) ) {
// assume that the composer.json file is in the root of the extension path
diff --git a/maintenance/copyJobQueue.php b/maintenance/copyJobQueue.php
index 0770b76ad9e..c96774f3d28 100644
--- a/maintenance/copyJobQueue.php
+++ b/maintenance/copyJobQueue.php
@@ -77,7 +77,7 @@ class CopyJobQueue extends Maintenance {
}
}
- protected function copyJobs( JobQueue $src, JobQueue $dst, $jobs ) {
+ protected function copyJobs( JobQueue $src, JobQueue $dst, iterable $jobs ): array {
$total = 0;
$totalOK = 0;
$batch = [];
diff --git a/maintenance/dumpBackup.php b/maintenance/dumpBackup.php
index fc673eb2bee..8f816ad6f12 100644
--- a/maintenance/dumpBackup.php
+++ b/maintenance/dumpBackup.php
@@ -33,7 +33,7 @@ require_once __DIR__ . '/includes/BackupDumper.php';
// @codeCoverageIgnoreEnd
class DumpBackup extends BackupDumper {
- public function __construct( $args = null ) {
+ public function __construct( ?array $args = null ) {
parent::__construct();
$this->addDescription( <<<TEXT
diff --git a/maintenance/dumpIterator.php b/maintenance/dumpIterator.php
index 3a8b82a8b6f..251b6fa10b1 100644
--- a/maintenance/dumpIterator.php
+++ b/maintenance/dumpIterator.php
@@ -138,7 +138,7 @@ abstract class DumpIterator extends Maintenance {
}
}
- public static function disableInterwikis( $prefix, &$data ) {
+ public static function disableInterwikis( string $prefix, array &$data ): bool {
# Title::newFromText will check on each namespaced article if it's an interwiki.
# We always answer that it is not.
diff --git a/maintenance/eraseArchivedFile.php b/maintenance/eraseArchivedFile.php
index b38a395375d..e3faf2677a4 100644
--- a/maintenance/eraseArchivedFile.php
+++ b/maintenance/eraseArchivedFile.php
@@ -92,7 +92,7 @@ class EraseArchivedFile extends Maintenance {
}
}
- protected function scrubAllVersions( $name ) {
+ protected function scrubAllVersions( string $name ) {
$dbw = $this->getPrimaryDB();
$queryBuilder = FileSelectQueryBuilder::newForArchivedFile( $dbw );
$queryBuilder->where( [ 'fa_name' => $name, 'fa_storage_group' => 'deleted' ] );
diff --git a/maintenance/findOrphanedFiles.php b/maintenance/findOrphanedFiles.php
index 813fa1adf9c..484243bfc37 100644
--- a/maintenance/findOrphanedFiles.php
+++ b/maintenance/findOrphanedFiles.php
@@ -75,7 +75,7 @@ class FindOrphanedFiles extends Maintenance {
$this->checkFiles( $repo, $pathBatch, $verbose );
}
- protected function checkFiles( LocalRepo $repo, array $paths, $verbose ) {
+ protected function checkFiles( LocalRepo $repo, array $paths, bool $verbose ) {
if ( !count( $paths ) ) {
return;
}
diff --git a/maintenance/fixDoubleRedirects.php b/maintenance/fixDoubleRedirects.php
index 53fa819cbe9..a568a451419 100644
--- a/maintenance/fixDoubleRedirects.php
+++ b/maintenance/fixDoubleRedirects.php
@@ -146,7 +146,7 @@ class FixDoubleRedirects extends Maintenance {
$this->output( "$n double redirects processed" . $processedTitles . "\n" );
}
- protected function queueJobs( $jobs, $dryrun = false ) {
+ protected function queueJobs( array $jobs, bool $dryrun = false ) {
$this->output( "Queuing batch of " . count( $jobs ) . " double redirects.\n" );
$this->getServiceContainer()->getJobQueueGroup()->push( $dryrun ? [] : $jobs );
}
diff --git a/maintenance/generateConfigSchema.php b/maintenance/generateConfigSchema.php
index 81e08ea0250..5b82570239a 100644
--- a/maintenance/generateConfigSchema.php
+++ b/maintenance/generateConfigSchema.php
@@ -173,7 +173,7 @@ class GenerateConfigSchema extends Maintenance {
}
}
- public function generateSchemaArray( array $allSchemas, array $obsolete ) {
+ public function generateSchemaArray( array $allSchemas, array $obsolete ): string {
$aggregator = new ConfigSchemaAggregator();
foreach ( $allSchemas as $key => $schema ) {
$aggregator->addSchema( $key, $schema );
@@ -218,7 +218,7 @@ class GenerateConfigSchema extends Maintenance {
return $content;
}
- public function generateNames( array $allSchemas ) {
+ public function generateNames( array $allSchemas ): string {
$code = "<?php\n";
$code .= "/**\n" .
" * This file is automatically generated using maintenance/generateConfigSchema.php.\n" .
@@ -283,7 +283,7 @@ class GenerateConfigSchema extends Maintenance {
return $code;
}
- public function generateSchemaYaml( array $allSchemas ) {
+ public function generateSchemaYaml( array $allSchemas ): string {
foreach ( $allSchemas as &$sch ) {
// Cast empty arrays to objects if they are declared to be of type object.
// This ensures they get represented in yaml as {} rather than [].
@@ -316,7 +316,7 @@ class GenerateConfigSchema extends Maintenance {
return $header . $yaml;
}
- public function generateVariableStubs( array $allSchemas ) {
+ public function generateVariableStubs( array $allSchemas ): string {
$content = "<?php\n";
$content .= "/**\n" .
" * This file is automatically generated using maintenance/generateConfigSchema.php.\n" .
diff --git a/maintenance/generateJsonI18n.php b/maintenance/generateJsonI18n.php
index d891cb52183..d9576f92fa9 100644
--- a/maintenance/generateJsonI18n.php
+++ b/maintenance/generateJsonI18n.php
@@ -97,7 +97,7 @@ class GenerateJsonI18n extends Maintenance {
}
}
- public function transformI18nFile( $phpfile, $jsondir = null ) {
+ public function transformI18nFile( string $phpfile, ?string $jsondir = null ) {
if ( !$jsondir ) {
// Assume the json directory should be in the same directory as the
// .i18n.php file.
diff --git a/maintenance/getConfiguration.php b/maintenance/getConfiguration.php
index a92a0e13014..2f24a7c91d7 100644
--- a/maintenance/getConfiguration.php
+++ b/maintenance/getConfiguration.php
@@ -173,7 +173,7 @@ class GetConfiguration extends Maintenance {
}
}
- protected function formatVarDump( $res ) {
+ protected function formatVarDump( array $res ): string {
$ret = '';
foreach ( $res as $key => $value ) {
# intercept var_dump() output
diff --git a/maintenance/grep.php b/maintenance/grep.php
index dd04a4d7810..b6431eebd0c 100644
--- a/maintenance/grep.php
+++ b/maintenance/grep.php
@@ -102,7 +102,7 @@ class GrepPages extends Maintenance {
}
}
- public function findPages( $prefixes = null ) {
+ public function findPages( ?array $prefixes = null ): iterable {
$dbr = $this->getReplicaDB();
$orConds = [];
if ( $prefixes !== null ) {
diff --git a/maintenance/importSiteScripts.php b/maintenance/importSiteScripts.php
index abc66b5ff79..1e80732a6b8 100644
--- a/maintenance/importSiteScripts.php
+++ b/maintenance/importSiteScripts.php
@@ -92,7 +92,7 @@ class ImportSiteScripts extends Maintenance {
}
}
- protected function fetchScriptList() {
+ protected function fetchScriptList(): array {
$data = [
'action' => 'query',
'format' => 'json',
diff --git a/maintenance/includes/BackupDumper.php b/maintenance/includes/BackupDumper.php
index 613f0812834..5edf14269e1 100644
--- a/maintenance/includes/BackupDumper.php
+++ b/maintenance/includes/BackupDumper.php
@@ -427,7 +427,7 @@ abstract class BackupDumper extends Maintenance {
$this->report();
}
- public function report( $final = false ) {
+ public function report( bool $final = false ) {
if ( $final xor ( $this->revCount % $this->reportingInterval == 0 ) ) {
$this->showReport();
}
@@ -474,7 +474,7 @@ abstract class BackupDumper extends Maintenance {
}
}
- protected function progress( $string ) {
+ protected function progress( string $string ) {
if ( $this->reporting ) {
fwrite( $this->stderr, $string . "\n" );
}
diff --git a/maintenance/includes/Benchmarker.php b/maintenance/includes/Benchmarker.php
index 8004739b811..e08defec855 100644
--- a/maintenance/includes/Benchmarker.php
+++ b/maintenance/includes/Benchmarker.php
@@ -159,7 +159,7 @@ abstract class Benchmarker extends Maintenance {
);
}
- public function addResult( $res ) {
+ public function addResult( array $res ) {
$ret = sprintf( "%s\n %' 6s: %d\n",
$res['name'],
'count',
@@ -189,7 +189,7 @@ abstract class Benchmarker extends Maintenance {
$this->output( "$ret\n" );
}
- protected function verboseRun( $iteration ) {
+ protected function verboseRun( int $iteration ) {
$this->output( sprintf( "#%3d - memory: %-10s - peak: %-10s\n",
$iteration,
$this->formatSize( memory_get_usage( true ) ),
diff --git a/maintenance/includes/ForkController.php b/maintenance/includes/ForkController.php
index 9bcd3a604c1..d0ecda034f1 100644
--- a/maintenance/includes/ForkController.php
+++ b/maintenance/includes/ForkController.php
@@ -241,7 +241,7 @@ class ForkController {
pcntl_signal( SIGTERM, SIG_DFL );
}
- protected function handleTermSignal( $signal ) {
+ protected function handleTermSignal( int $signal ) {
$this->termReceived = true;
}
}
diff --git a/maintenance/includes/TextPassDumper.php b/maintenance/includes/TextPassDumper.php
index 2703116d361..1c62a206ab0 100644
--- a/maintenance/includes/TextPassDumper.php
+++ b/maintenance/includes/TextPassDumper.php
@@ -274,7 +274,7 @@ TEXT
$this->report( true );
}
- protected function processFileOpt( $opt ) {
+ protected function processFileOpt( string $opt ): string {
$split = explode( ':', $opt, 2 );
$val = $split[0];
$param = '';
@@ -747,7 +747,7 @@ TEXT
return $text;
}
- protected function openSpawn() {
+ protected function openSpawn(): bool {
global $IP;
$wiki = WikiMap::getCurrentWikiId();
@@ -888,7 +888,7 @@ TEXT
return $normalized;
}
- protected function startElement( $parser, $name, $attribs ) {
+ protected function startElement( $parser, string $name, array $attribs ) {
$this->checkpointJustWritten = false;
$this->clearOpenElement( null );
@@ -942,7 +942,7 @@ TEXT
}
}
- protected function endElement( $parser, $name ) {
+ protected function endElement( $parser, string $name ) {
$this->checkpointJustWritten = false;
if ( $this->openElement ) {
@@ -1003,7 +1003,7 @@ TEXT
}
}
- protected function characterData( $parser, $data ) {
+ protected function characterData( $parser, string $data ) {
$this->clearOpenElement( null );
if ( $this->lastName == "id" ) {
if ( $this->state == "revision" ) {
@@ -1035,7 +1035,7 @@ TEXT
$this->buffer .= htmlspecialchars( $data, ENT_COMPAT );
}
- protected function clearOpenElement( $style ) {
+ protected function clearOpenElement( ?string $style ) {
if ( $this->openElement ) {
$this->buffer .= Xml::element( $this->openElement[0], $this->openElement[1], $style );
$this->openElement = false;
diff --git a/maintenance/language/generateCollationData.php b/maintenance/language/generateCollationData.php
index cee6cd0accc..e16f2668f53 100644
--- a/maintenance/language/generateCollationData.php
+++ b/maintenance/language/generateCollationData.php
@@ -318,11 +318,11 @@ class UcdXmlReader {
/** @var array */
public $currentBlock;
- public function __construct( $fileName ) {
+ public function __construct( string $fileName ) {
$this->fileName = $fileName;
}
- public function readChars( $callback ) {
+ public function readChars( callable $callback ) {
$this->getBlocks();
$this->currentBlock = reset( $this->blocks );
$xml = $this->open();
@@ -346,7 +346,7 @@ class UcdXmlReader {
$xml->close();
}
- protected function open() {
+ protected function open(): XMLReader {
$this->xml = new XMLReader;
if ( !$this->xml->open( $this->fileName ) ) {
throw new RuntimeException( __METHOD__ . ": unable to open {$this->fileName}" );
@@ -406,7 +406,7 @@ class UcdXmlReader {
}
}
- public function getBlocks() {
+ public function getBlocks(): array {
if ( $this->blocks ) {
return $this->blocks;
}
diff --git a/maintenance/migrateFileRepoLayout.php b/maintenance/migrateFileRepoLayout.php
index 3a1a7e348a6..48ef16995d3 100644
--- a/maintenance/migrateFileRepoLayout.php
+++ b/maintenance/migrateFileRepoLayout.php
@@ -24,6 +24,7 @@
use MediaWiki\FileRepo\File\File;
use MediaWiki\FileRepo\File\LocalFile;
use MediaWiki\FileRepo\FileBackendDBRepoWrapper;
+use MediaWiki\FileRepo\LocalRepo;
use MediaWiki\Maintenance\Maintenance;
use Wikimedia\FileBackend\FileBackend;
@@ -230,7 +231,7 @@ class MigrateFileRepoLayout extends Maintenance {
$this->output( "Done (started $startTime)\n" );
}
- protected function getRepo() {
+ protected function getRepo(): LocalRepo {
return $this->getServiceContainer()->getRepoGroup()->getLocalRepo();
}
diff --git a/maintenance/nukePage.php b/maintenance/nukePage.php
index a932894d634..42a3c50716a 100644
--- a/maintenance/nukePage.php
+++ b/maintenance/nukePage.php
@@ -116,7 +116,7 @@ class NukePage extends Maintenance {
}
}
- public function deleteRevisions( $ids ) {
+ public function deleteRevisions( array $ids ) {
$dbw = $this->getPrimaryDB();
$this->beginTransaction( $dbw, __METHOD__ );
diff --git a/maintenance/purgeChangedFiles.php b/maintenance/purgeChangedFiles.php
index 829c8b9d1c1..61861eaa892 100644
--- a/maintenance/purgeChangedFiles.php
+++ b/maintenance/purgeChangedFiles.php
@@ -243,7 +243,7 @@ class PurgeChangedFiles extends Maintenance {
}
}
- protected function getDeletedPath( LocalRepo $repo, LocalFile $file ) {
+ protected function getDeletedPath( LocalRepo $repo, LocalFile $file ): string {
$hash = $repo->getFileSha1( $file->getPath() );
$key = "{$hash}.{$file->getExtension()}";
diff --git a/maintenance/purgeParserCache.php b/maintenance/purgeParserCache.php
index 7444cfa456f..3af7f4af455 100644
--- a/maintenance/purgeParserCache.php
+++ b/maintenance/purgeParserCache.php
@@ -110,7 +110,7 @@ class PurgeParserCache extends Maintenance {
$this->output( "\nDone\n" );
}
- public function showProgressAndWait( $percent ) {
+ public function showProgressAndWait( int $percent ) {
// Parser caches involve mostly-unthrottled writes of large blobs. This is sometimes prone
// to replication lag. As such, while our purge queries are simple primary key deletes,
// we want to avoid adding significant load to the replication stream, by being
diff --git a/maintenance/rebuildImages.php b/maintenance/rebuildImages.php
index 7983cbcdf8d..a75e5915450 100644
--- a/maintenance/rebuildImages.php
+++ b/maintenance/rebuildImages.php
@@ -212,7 +212,7 @@ class ImageBuilder extends Maintenance {
$this->getRepo()->enumFiles( [ $this, 'checkMissingImage' ] );
}
- public function checkMissingImage( $fullpath ) {
+ public function checkMissingImage( string $fullpath ) {
$filename = wfBaseName( $fullpath );
$row = $this->dbw->newSelectQueryBuilder()
->select( [ 'img_name' ] )
diff --git a/maintenance/recountCategories.php b/maintenance/recountCategories.php
index d70ba2b105e..eedd1ee3bec 100644
--- a/maintenance/recountCategories.php
+++ b/maintenance/recountCategories.php
@@ -131,7 +131,7 @@ TEXT
}
}
- protected function doWork( $mode ) {
+ protected function doWork( string $mode ) {
$this->output( "Finding up to {$this->getBatchSize()} drifted rows " .
"greater than cat_id {$this->minimumId}...\n" );
diff --git a/maintenance/storage/fixLegacyEncoding.php b/maintenance/storage/fixLegacyEncoding.php
index bc4965da116..f7aaf271d74 100644
--- a/maintenance/storage/fixLegacyEncoding.php
+++ b/maintenance/storage/fixLegacyEncoding.php
@@ -21,6 +21,7 @@
use MediaWiki\Storage\SqlBlobStore;
use Wikimedia\Rdbms\IExpression;
+use Wikimedia\Rdbms\IReadableDatabase;
use Wikimedia\Rdbms\LikeValue;
// @codeCoverageIgnoreStart
@@ -33,7 +34,7 @@ class FixLegacyEncoding extends MoveToExternal {
$this->addDescription( 'Change encoding of stored content from legacy encoding to UTF-8' );
}
- protected function getConditions( $blockStart, $blockEnd, $dbr ) {
+ protected function getConditions( int $blockStart, int $blockEnd, IReadableDatabase $dbr ): array {
return [
$dbr->expr( 'old_id', '>=', $blockStart ),
$dbr->expr( 'old_id', '<=', $blockEnd ),
@@ -44,7 +45,7 @@ class FixLegacyEncoding extends MoveToExternal {
];
}
- protected function resolveText( $text, $flags ) {
+ protected function resolveText( string $text, array $flags ): array {
if ( in_array( 'error', $flags ) ) {
return [ $text, $flags ];
}
diff --git a/maintenance/storage/moveToExternal.php b/maintenance/storage/moveToExternal.php
index f865fd7a32a..397a2395b6d 100644
--- a/maintenance/storage/moveToExternal.php
+++ b/maintenance/storage/moveToExternal.php
@@ -27,6 +27,7 @@ use MediaWiki\Maintenance\UndoLog;
use MediaWiki\Storage\SqlBlobStore;
use Wikimedia\AtEase\AtEase;
use Wikimedia\Rdbms\IExpression;
+use Wikimedia\Rdbms\IReadableDatabase;
use Wikimedia\Rdbms\LikeValue;
// @codeCoverageIgnoreStart
@@ -321,7 +322,7 @@ class MoveToExternal extends Maintenance {
$this->output( "$numResolved of $numTotal stubs resolved\n" );
}
- protected function getConditions( $blockStart, $blockEnd, $dbr ) {
+ protected function getConditions( int $blockStart, int $blockEnd, IReadableDatabase $dbr ): array {
return [
$dbr->expr( 'old_id', '>=', $blockStart ),
$dbr->expr( 'old_id', '>=', $blockEnd ),
@@ -330,7 +331,7 @@ class MoveToExternal extends Maintenance {
];
}
- protected function resolveText( $text, $flags ) {
+ protected function resolveText( string $text, array $flags ): array {
return [ $text, $flags ];
}
}
diff --git a/maintenance/storage/orphanStats.php b/maintenance/storage/orphanStats.php
index 6872f856033..84065078d40 100644
--- a/maintenance/storage/orphanStats.php
+++ b/maintenance/storage/orphanStats.php
@@ -22,6 +22,7 @@
*/
use MediaWiki\Maintenance\Maintenance;
+use Wikimedia\Rdbms\IDatabase;
// @codeCoverageIgnoreStart
require_once __DIR__ . '/../Maintenance.php';
@@ -40,7 +41,7 @@ class OrphanStats extends Maintenance {
"Show some statistics on the blob_orphans table, created with trackBlobs.php" );
}
- protected function getExternalDB( $db, $cluster ) {
+ protected function getExternalDB( int $db, string $cluster ): IDatabase {
$lbFactory = $this->getServiceContainer()->getDBLoadBalancerFactory();
$lb = $lbFactory->getExternalLB( $cluster );
diff --git a/maintenance/storage/recompressTracked.php b/maintenance/storage/recompressTracked.php
index b6f39493704..7a927b995ed 100644
--- a/maintenance/storage/recompressTracked.php
+++ b/maintenance/storage/recompressTracked.php
@@ -133,7 +133,7 @@ class RecompressTracked {
return new self( $jobOptions );
}
- public function __construct( $options ) {
+ public function __construct( array $options ) {
foreach ( $options as $name => $value ) {
$this->$name = $value;
}
diff --git a/maintenance/updateExtensionJsonSchema.php b/maintenance/updateExtensionJsonSchema.php
index 1087557197f..419ffaec30b 100644
--- a/maintenance/updateExtensionJsonSchema.php
+++ b/maintenance/updateExtensionJsonSchema.php
@@ -84,7 +84,7 @@ class UpdateExtensionJsonSchema extends Maintenance {
}
}
- protected function updateTo2( &$json ) {
+ protected function updateTo2( array &$json ) {
if ( isset( $json['config'] ) ) {
$config = $json['config'];
$json['config'] = [];
diff --git a/maintenance/updateSpecialPages.php b/maintenance/updateSpecialPages.php
index 2e7586f71c4..d1fc81e153a 100644
--- a/maintenance/updateSpecialPages.php
+++ b/maintenance/updateSpecialPages.php
@@ -29,6 +29,7 @@ require_once __DIR__ . '/Maintenance.php';
use MediaWiki\MainConfigNames;
use MediaWiki\Maintenance\Maintenance;
use MediaWiki\SpecialPage\QueryPage;
+use Wikimedia\Rdbms\IDatabase;
/**
* Maintenance script to update cached special pages.
@@ -141,7 +142,7 @@ class UpdateSpecialPages extends Maintenance {
$this->waitForReplication();
}
- public function doSpecialPageCacheUpdates( $dbw ) {
+ public function doSpecialPageCacheUpdates( IDatabase $dbw ) {
foreach ( $this->getConfig()->get( MainConfigNames::SpecialPageCacheUpdates ) as $special => $call ) {
# --list : just show the name of pages
if ( $this->hasOption( 'list' ) ) {

File Metadata

Mime Type
text/x-diff
Expires
Sat, Jul 5, 5:32 AM (11 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
227534
Default Alt Text
(27 KB)

Event Timeline