aboutsummaryrefslogtreecommitdiffstats
path: root/includes
diff options
context:
space:
mode:
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>2025-04-04 01:04:22 +0000
committerGerrit Code Review <gerrit@wikimedia.org>2025-04-04 01:04:22 +0000
commit681c51692d9dc6bc2d3e2e8148bced6cdc7007a7 (patch)
tree15843bce850d3896711ce83ba8256ba941f3276e /includes
parentd0fd2b39add6658f6e2d63249e3f5096c10b4052 (diff)
parentc3ec177e6d9a350e8a5f1ade4dc17f5fcc4987d9 (diff)
downloadmediawikicore-681c51692d9dc6bc2d3e2e8148bced6cdc7007a7.tar.gz
mediawikicore-681c51692d9dc6bc2d3e2e8148bced6cdc7007a7.zip
Merge "file: Use type declaration on undocumented private functions"
Diffstat (limited to 'includes')
-rw-r--r--includes/filerepo/ThumbnailEntryPoint.php4
-rw-r--r--includes/filerepo/file/File.php2
-rw-r--r--includes/filerepo/file/FileSelectQueryBuilder.php10
-rw-r--r--includes/filerepo/file/OldLocalFile.php4
-rw-r--r--includes/filerepo/file/UnregisteredLocalFile.php2
-rw-r--r--includes/jobqueue/jobs/ThumbnailRenderJob.php2
-rw-r--r--includes/media/DjVuImage.php12
-rw-r--r--includes/media/SVGReader.php2
-rw-r--r--includes/upload/UploadBase.php2
-rw-r--r--includes/upload/UploadFromChunks.php2
10 files changed, 22 insertions, 20 deletions
diff --git a/includes/filerepo/ThumbnailEntryPoint.php b/includes/filerepo/ThumbnailEntryPoint.php
index a1ae53359a1b..e8367ada0d2b 100644
--- a/includes/filerepo/ThumbnailEntryPoint.php
+++ b/includes/filerepo/ThumbnailEntryPoint.php
@@ -673,7 +673,7 @@ EOT;
return false;
}
- private function vary( $header ) {
+ private function vary( string $header ) {
$this->varyHeader[] = $header;
}
@@ -823,7 +823,7 @@ EOT;
return false;
}
- private function maybeEnforceRateLimits( File $img, array $params ) {
+ private function maybeEnforceRateLimits( File $img, array $params ): bool {
$authority = $this->getContext()->getAuthority();
$status = PermissionStatus::newEmpty();
diff --git a/includes/filerepo/file/File.php b/includes/filerepo/file/File.php
index 30844f5c2059..6cb4d8018da0 100644
--- a/includes/filerepo/file/File.php
+++ b/includes/filerepo/file/File.php
@@ -1147,7 +1147,7 @@ abstract class File implements MediaHandlerState {
return $thumbName;
}
- private function adjustThumbWidthForSteps( $params ) {
+ private function adjustThumbWidthForSteps( array $params ): array {
$thumbnailSteps = MediaWikiServices::getInstance()
->getMainConfig()->get( MainConfigNames::ThumbnailSteps );
$thumbnailStepsRatio = MediaWikiServices::getInstance()
diff --git a/includes/filerepo/file/FileSelectQueryBuilder.php b/includes/filerepo/file/FileSelectQueryBuilder.php
index a61357b00949..23cf5597a9a1 100644
--- a/includes/filerepo/file/FileSelectQueryBuilder.php
+++ b/includes/filerepo/file/FileSelectQueryBuilder.php
@@ -73,7 +73,7 @@ class FileSelectQueryBuilder extends SelectQueryBuilder {
return new FileSelectQueryBuilder( $db, 'archivedfile', $options );
}
- private function initFileOld( $options ) {
+ private function initFileOld( array $options ) {
$this->table( 'image' )
->join( 'actor', 'image_actor', 'actor_id=img_actor' )
->join(
@@ -112,7 +112,7 @@ class FileSelectQueryBuilder extends SelectQueryBuilder {
}
}
- private function initFileNew( $options ) {
+ private function initFileNew( array $options ) {
$subquery = $this->newSubquery();
$subquery->table( 'file' )
->join( 'filerevision', null, 'file_latest = fr_id' )
@@ -164,7 +164,7 @@ class FileSelectQueryBuilder extends SelectQueryBuilder {
->from( $subquery );
}
- private function initOldFileOld( $options ) {
+ private function initOldFileOld( array $options ) {
$this->table( 'oldimage' )
->join( 'actor', 'oldimage_actor', 'actor_id=oi_actor' )
->join(
@@ -204,7 +204,7 @@ class FileSelectQueryBuilder extends SelectQueryBuilder {
}
}
- private function initOldFileNew( $options ) {
+ private function initOldFileNew( array $options ) {
$subquery = $this->newSubquery();
$subquery->table( 'filerevision' )
->join( 'file', null, 'fr_file = file_id' )
@@ -253,7 +253,7 @@ class FileSelectQueryBuilder extends SelectQueryBuilder {
->from( $subquery );
}
- private function initArchivedFile( $options ) {
+ private function initArchivedFile( array $options ) {
$this->table( 'filearchive' )
->join( 'actor', 'filearchive_actor', 'actor_id=fa_actor' )
->join(
diff --git a/includes/filerepo/file/OldLocalFile.php b/includes/filerepo/file/OldLocalFile.php
index 76b624f1d5ad..8e4e7811b217 100644
--- a/includes/filerepo/file/OldLocalFile.php
+++ b/includes/filerepo/file/OldLocalFile.php
@@ -261,7 +261,9 @@ class OldLocalFile extends LocalFile {
}
}
- private function buildQueryBuilderForLoad( IReadableDatabase $dbr, $options = [ 'omit-nonlazy' ] ) {
+ private function buildQueryBuilderForLoad(
+ IReadableDatabase $dbr, array $options = [ 'omit-nonlazy' ]
+ ): FileSelectQueryBuilder {
$queryBuilder = FileSelectQueryBuilder::newForOldFile( $dbr, $options );
$queryBuilder->where( [ 'oi_name' => $this->getName() ] )
->orderBy( 'oi_timestamp', SelectQueryBuilder::SORT_DESC );
diff --git a/includes/filerepo/file/UnregisteredLocalFile.php b/includes/filerepo/file/UnregisteredLocalFile.php
index e09923859f0c..1f4ccd182794 100644
--- a/includes/filerepo/file/UnregisteredLocalFile.php
+++ b/includes/filerepo/file/UnregisteredLocalFile.php
@@ -199,7 +199,7 @@ class UnregisteredLocalFile extends File {
return $info['metadata'];
}
- private function getSizeAndMetadata() {
+ private function getSizeAndMetadata(): array {
if ( $this->sizeAndMetadata === null ) {
if ( !$this->getHandler() ) {
$this->sizeAndMetadata = [ 'width' => 0, 'height' => 0, 'metadata' => [] ];
diff --git a/includes/jobqueue/jobs/ThumbnailRenderJob.php b/includes/jobqueue/jobs/ThumbnailRenderJob.php
index 5fbdb3823bd6..f12532e27a9e 100644
--- a/includes/jobqueue/jobs/ThumbnailRenderJob.php
+++ b/includes/jobqueue/jobs/ThumbnailRenderJob.php
@@ -153,7 +153,7 @@ class ThumbnailRenderJob extends Job {
return false;
}
- private function maybeEnqueueNextPage( $transformParams ) {
+ private function maybeEnqueueNextPage( array $transformParams ) {
if (
( $this->params['enqueueNextPage'] ?? false ) &&
( $transformParams['page'] ?? 0 ) < ( $this->params['pageLimit'] ?? 0 )
diff --git a/includes/media/DjVuImage.php b/includes/media/DjVuImage.php
index 1ff80602730e..d5a18e75bd6d 100644
--- a/includes/media/DjVuImage.php
+++ b/includes/media/DjVuImage.php
@@ -97,7 +97,7 @@ class DjVuImage {
fclose( $file );
}
- private function dumpForm( $file, $length, $indent ) {
+ private function dumpForm( $file, int $length, int $indent ) {
$start = ftell( $file );
$secondary = fread( $file, 4 );
echo str_repeat( ' ', $indent * 4 ) . "($secondary)\n";
@@ -159,7 +159,7 @@ class DjVuImage {
return $info;
}
- private function readChunk( $file ) {
+ private function readChunk( $file ): array {
$header = fread( $file, 8 );
if ( strlen( $header ) < 8 ) {
return [ false, 0 ];
@@ -169,7 +169,7 @@ class DjVuImage {
return [ $arr['chunk'], $arr['length'] ];
}
- private function skipChunk( $file, $chunkLength ) {
+ private function skipChunk( $file, int $chunkLength ) {
fseek( $file, $chunkLength, SEEK_CUR );
if ( ( $chunkLength & 1 ) && !feof( $file ) ) {
@@ -178,7 +178,7 @@ class DjVuImage {
}
}
- private function getMultiPageInfo( $file, $formLength ) {
+ private function getMultiPageInfo( $file, int $formLength ) {
// For now, we'll just look for the first page in the file
// and report its information, hoping others are the same size.
$start = ftell( $file );
@@ -366,7 +366,7 @@ EOR;
return $json;
}
- private function pageTextCallback( string $match ) {
+ private function pageTextCallback( string $match ): string {
# Get rid of invalid UTF-8
$val = UtfNormal\Validator::cleanUp( stripcslashes( $match ) );
return str_replace( '�', '', $val );
@@ -434,7 +434,7 @@ EOR;
return $result;
}
- private function parseFormDjvu( $line ) {
+ private function parseFormDjvu( string $line ) {
$parentLevel = strspn( $line, ' ' );
$line = strtok( "\n" );
# Find INFO
diff --git a/includes/media/SVGReader.php b/includes/media/SVGReader.php
index f988456e2f66..f68f446f1ccb 100644
--- a/includes/media/SVGReader.php
+++ b/includes/media/SVGReader.php
@@ -314,7 +314,7 @@ class SVGReader {
}
}
- private function debug( $data ) {
+ private function debug( string $data ) {
if ( $this->mDebug ) {
wfDebug( "SVGReader: $data" );
}
diff --git a/includes/upload/UploadBase.php b/includes/upload/UploadBase.php
index 48a8f1240273..17f97ee56fba 100644
--- a/includes/upload/UploadBase.php
+++ b/includes/upload/UploadBase.php
@@ -918,7 +918,7 @@ abstract class UploadBase {
return $warnings;
}
- private function checkLocalFileWasDeleted( LocalFile $localFile ) {
+ private function checkLocalFileWasDeleted( LocalFile $localFile ): bool {
return $localFile->wasDeleted() && !$localFile->exists();
}
diff --git a/includes/upload/UploadFromChunks.php b/includes/upload/UploadFromChunks.php
index 85a486dbeaf7..d484a3516022 100644
--- a/includes/upload/UploadFromChunks.php
+++ b/includes/upload/UploadFromChunks.php
@@ -449,7 +449,7 @@ class UploadFromChunks extends UploadFromFile {
return $storeStatus;
}
- private function getChunkFileKey( $index = null ) {
+ private function getChunkFileKey( ?int $index = null ): string {
return $this->mFileKey . '.' . ( $index ?? $this->getChunkIndex() );
}