/**
* Register an array of file backend configurations
*
- * @param array $configs
+ * @param array[] $configs
* @param string|null $readOnlyReason
* @throws InvalidArgumentException
*/
/**
* @see FileJournal::doGetChangeEntries()
- * @param int $start
+ * @param int|null $start
* @param int $limit
- * @return array
+ * @return array[]
*/
protected function doGetChangeEntries( $start, $limit ) {
$dbw = $this->getMasterDB();
* E.g. mwstore://local-backend/local-public/a/ab/<name>.jpg
* => mwstore://local-backend/local-original/x/y/z/<sha1>.jpg
*
- * @param array $paths
+ * @param string[] $paths
* @param bool $latest
- * @return array Translated paths in same order
+ * @return string[] Translated paths in same order
*/
public function getBackendPaths( array $paths, $latest = true ) {
$db = $this->getDB( $latest ? DB_MASTER : DB_REPLICA );
*
* This leaves destination paths alone since we don't want those to mutate
*
- * @param array $ops
- * @return array
+ * @param array[] $ops
+ * @return array[]
*/
protected function mungeOpPaths( array $ops ) {
// Ops that use 'src' and do not mutate core file data there
* Get an array of arrays or iterators of file objects for files that
* have the given SHA-1 content hashes.
*
- * @param array $hashes An array of hashes
- * @return array An Array of arrays or iterators of file objects and the hash as key
+ * @param string[] $hashes An array of hashes
+ * @return array[] An Array of arrays or iterators of file objects and the hash as key
*/
public function findBySha1s( array $hashes ) {
$result = [];
* STUB
* @param string $prefix The prefix to search for
* @param int $limit The maximum amount of files to return
- * @return array
+ * @return LocalFile[]
*/
public function findFilesByPrefix( $prefix, $limit ) {
return [];
* should use File::getDescriptionText().
*
* @param string $name Name of image to fetch
- * @param string $lang Language to fetch it in, if any.
+ * @param string|null $lang Language to fetch it in, if any.
* @return string|false
*/
public function getDescriptionRenderUrl( $name, $lang = null ) {
* Each file can be a (zone, rel) pair, virtual url, storage path.
* It will try to delete each file, but ignores any errors that may occur.
*
- * @param array $files List of files to delete
+ * @param string[] $files List of files to delete
* @param int $flags Bitwise combination of the following flags:
* self::SKIP_LOCKING Skip any file locking when doing the deletions
* @return Status
/**
* Checks existence of an array of files.
*
- * @param array $files Virtual URLs (or storage paths) of files to check
+ * @param string[] $files Virtual URLs (or storage paths) of files to check
* @return array Map of files and existence flags, or false
*/
public function fileExistsBatch( array $files ) {
* Delete files in the deleted directory if they are not referenced in the filearchive table
*
* STUB
- * @param array $storageKeys
+ * @param string[] $storageKeys
*/
public function cleanupDeletedBatch( array $storageKeys ) {
$this->assertWritableRepo();
/**
* Get a callback function to use for cleaning error message parameters
*
- * @return array
+ * @return string[]
*/
function getErrorCleanupFunction() {
switch ( $this->pathDisclosureProtection ) {
/**
* Get an UploadStash associated with this repo.
*
- * @param User $user
+ * @param User|null $user
* @return UploadStash
*/
public function getUploadStash( User $user = null ) {
}
/**
- * @param array $files
+ * @param string[] $files
* @return array
*/
function fileExistsBatch( array $files ) {
/**
* @param string $virtualUrl
- * @return bool
+ * @return false
*/
function getFileProps( $virtualUrl ) {
return false;
/**
* @param string $hash
- * @return array
+ * @return ForeignAPIFile[]
*/
function findBySha1( $hash ) {
$results = $this->fetchImageQuery( [
* @param string $name
* @param int $width
* @param int $height
- * @param array &$result
+ * @param array|null &$result Output-only parameter, guaranteed to become an array
* @param string $otherParams
*
- * @return bool
+ * @return string|false
*/
function getThumbUrl( $name, $width = -1, $height = -1, &$result = null, $otherParams = '' ) {
$data = $this->fetchImageQuery( [
* @param int $width
* @param int $height
* @param string $otherParams
- * @param string $lang Language code for language of error
+ * @param string|null $lang Language code for language of error
* @return bool|MediaTransformError
* @since 1.22
*/
* interleave database locks with file operations, which is potentially a
* remote operation.
*
- * @param array $storageKeys
+ * @param string[] $storageKeys
*
* @return Status
*/
* SHA-1 content hash.
*
* @param string $hash A sha1 hash to look for
- * @return File[]
+ * @return LocalFile[]
*/
function findBySha1( $hash ) {
$dbr = $this->getReplicaDB();
*
* Overrides generic implementation in FileRepo for performance reason
*
- * @param array $hashes An array of hashes
- * @return array An Array of arrays or iterators of file objects and the hash as key
+ * @param string[] $hashes An array of hashes
+ * @return array[] An Array of arrays or iterators of file objects and the hash as key
*/
function findBySha1s( array $hashes ) {
if ( !count( $hashes ) ) {
*
* @param string $prefix The prefix to search for
* @param int $limit The maximum amount of files to return
- * @return array
+ * @return LocalFile[]
*/
public function findFilesByPrefix( $prefix, $limit ) {
$selectOptions = [ 'ORDER BY' => 'img_name', 'LIMIT' => intval( $limit ) ];
* Split a virtual URL into repo, zone and rel parts
* @param string $url
* @throws MWException
- * @return array Containing repo, zone and rel
+ * @return string[] Containing repo, zone and rel
*/
function splitVirtualUrl( $url ) {
if ( substr( $url, 0, 9 ) != 'mwrepo://' ) {
/**
* Fields in the filearchive table
* @deprecated since 1.31, use self::getQueryInfo() instead.
- * @return array
+ * @return string[]
*/
static function selectFields() {
global $wgActorTableSchemaMigrationStage;
* Return the tables, fields, and join conditions to be selected to create
* a new archivedfile object.
* @since 1.31
- * @return array With three keys:
+ * @return array[] With three keys:
* - tables: (string[]) to include in the `$table` to `IDatabase->select()`
* - fields: (string[]) to include in the `$vars` to `IDatabase->select()`
* - joins: (array) to include in the `$join_conds` to `IDatabase->select()`
* a two-part name, set the minor type to 'unknown'.
*
* @param string $mime "text/html" etc
- * @return array ("text", "html") etc
+ * @return string[] ("text", "html") etc
*/
public static function splitMime( $mime ) {
if ( strpos( $mime, '/' ) !== false ) {
* format does not support that sort of thing, returns
* an empty array.
*
- * @return array
+ * @return string[]
* @since 1.23
*/
public function getAvailableLanguages() {
* Get all thumbnail names previously generated for this file
* STUB
* Overridden by LocalFile
- * @return array
+ * @return string[]
*/
function getThumbnails() {
return [];
* Return a fragment of the history of file.
*
* STUB
- * @param int $limit Limit of rows to return
- * @param string $start Only revisions older than $start will be returned
- * @param string $end Only revisions newer than $end will be returned
+ * @param int|null $limit Limit of rows to return
+ * @param string|int|null $start Only revisions older than $start will be returned
+ * @param string|int|null $end Only revisions newer than $end will be returned
* @param bool $inc Include the endpoints of the time range
*
* @return File[]
* File::FOR_PUBLIC to be displayed to all users
* File::FOR_THIS_USER to be displayed to the given user
* File::RAW get the description regardless of permissions
- * @param User $user User object to check for, only if FOR_THIS_USER is
+ * @param User|null $user User object to check for, only if FOR_THIS_USER is
* passed to the $audience parameter
- * @return string
+ * @return null|string
*/
function getDescription( $audience = self::FOR_PUBLIC, User $user = null ) {
return null;
* field of this file, if it's marked as deleted.
* STUB
* @param int $field
- * @param User $user User object to check, or null to use $wgUser
+ * @param User|null $user User object to check, or null to use $wgUser
* @return bool
*/
function userCan( $field, User $user = null ) {
}
/**
- * @return array HTTP header name/value map to use for HEAD/GET request responses
+ * @return string[] HTTP header name/value map to use for HEAD/GET request responses
* @since 1.30
*/
function getContentHeaders() {
}
/**
- * @param array $metadata
- * @return array
+ * @param mixed $metadata
+ * @return mixed
*/
public static function parseMetadata( $metadata ) {
if ( !is_array( $metadata ) ) {
/**
* @param int $audience
- * @param User $user
+ * @param User|null $user
* @return null|string
*/
public function getDescription( $audience = self::FOR_PUBLIC, User $user = null ) {
}
/**
- * @return array
+ * @return string[]
*/
function getThumbnails() {
$dir = $this->getThumbPath( $this->getName() );
* @param string $source
* @param bool $watch
* @param bool|string $timestamp
- * @param User $user User object or null to use $wgUser
+ * @param User|null $user User object or null to use $wgUser
* @return bool
* @throws MWException
*/
* @param FileRepo $repo
* @param null $unused
*
- * @return LocalFile
+ * @return self
*/
static function newFromTitle( $title, $repo, $unused = null ) {
return new self( $title, $repo );
* @param stdClass $row
* @param FileRepo $repo
*
- * @return LocalFile
+ * @return self
*/
static function newFromRow( $row, $repo ) {
$title = Title::makeTitle( NS_FILE, $row->img_name );
/**
* Fields in the image table
* @deprecated since 1.31, use self::getQueryInfo() instead.
- * @return array
+ * @return string[]
*/
static function selectFields() {
global $wgActorTableSchemaMigrationStage;
* @since 1.31
* @param string[] $options
* - omit-lazy: Omit fields that are lazily cached.
- * @return array With three keys:
+ * @return array[] With three keys:
* - tables: (string[]) to include in the `$table` to `IDatabase->select()`
* - fields: (string[]) to include in the `$vars` to `IDatabase->select()`
* - joins: (array) to include in the `$join_conds` to `IDatabase->select()`
/**
* Returns the list of object properties that are included as-is in the cache.
* @param string $prefix Must be the empty string
- * @return array
+ * @return string[]
* @since 1.31 No longer accepts a non-empty $prefix
*/
protected function getCacheFields( $prefix = 'img_' ) {
* Returns the list of object properties that are included as-is in the
* cache, only when they're not too big, and are lazily loaded by self::loadExtraFromDB().
* @param string $prefix Must be the empty string
- * @return array
+ * @return string[]
* @since 1.31 No longer accepts a non-empty $prefix
*/
protected function getLazyCacheFields( $prefix = 'img_' ) {
/**
* @param IDatabase $dbr
* @param string $fname
- * @return array|bool
+ * @return string[]|bool
*/
private function loadExtraFieldsWithTimestamp( $dbr, $fname ) {
$fieldMap = false;
/** purgeEverything inherited */
/**
- * @param int $limit Optional: Limit to number of results
- * @param int $start Optional: Timestamp, start from
- * @param int $end Optional: Timestamp, end at
+ * @param int|null $limit Optional: Limit to number of results
+ * @param string|int|null $start Optional: Timestamp, start from
+ * @param string|int|null $end Optional: Timestamp, end at
* @param bool $inc
* @return OldLocalFile[]
*/
* This is not used by ImagePage for local files, since (among other things)
* it skips the parser cache.
*
- * @param Language $lang What language to get description in (Optional)
- * @return bool|mixed
+ * @param Language|null $lang What language to get description in (Optional)
+ * @return string|false
*/
function getDescriptionText( $lang = null ) {
$revision = Revision::newFromTitle( $this->title, false, Revision::READ_NORMAL );
/**
* @param int $audience
- * @param User $user
+ * @param User|null $user
* @return string
*/
function getDescription( $audience = self::FOR_PUBLIC, User $user = null ) {
/**
* Add the old versions of the image to the batch
- * @return array List of archive names from old versions
+ * @return string[] List of archive names from old versions
*/
public function addOlds() {
$archiveNames = [];
/** @var LocalFile */
private $file;
- /** @var array List of file IDs to restore */
+ /** @var string[] List of file IDs to restore */
private $cleanupBatch;
- /** @var array List of file IDs to restore */
+ /** @var string[] List of file IDs to restore */
private $ids;
/** @var bool Add all revisions of the file */
*/
function __construct( File $file, $unsuppress = false ) {
$this->file = $file;
- $this->cleanupBatch = $this->ids = [];
+ $this->cleanupBatch = [];
$this->ids = [];
$this->unsuppress = $unsuppress;
}
/**
* Removes non-existent files from a cleanup batch.
- * @param array $batch
- * @return array
+ * @param string[] $batch
+ * @return string[]
*/
protected function removeNonexistentFromCleanup( $batch ) {
$files = $newBatch = [];
* rollback by removing all items that were succesfully copied.
*
* @param Status $storeStatus
- * @param array $storeBatch
+ * @param array[] $storeBatch
*/
protected function cleanupFailedBatch( $storeStatus, $storeBatch ) {
$cleanupBatch = [];
/**
* Add the old versions of the image to the batch
- * @return array List of archive names from old versions
+ * @return string[] List of archive names from old versions
*/
public function addOlds() {
$archiveBase = 'archive';
/**
* Generate triplets for FileRepo::storeBatch().
- * @return array
+ * @return array[]
*/
protected function getMoveTriplets() {
$moves = array_merge( [ $this->cur ], $this->olds );
/**
* Cleanup a partially moved array of triplets by deleting the target
* files. Called if something went wrong half way.
- * @param array $triplets
+ * @param array[] $triplets
*/
protected function cleanupTarget( $triplets ) {
// Create dest pairs from the triplets
/**
* Cleanup a fully moved array of triplets by deleting the source files.
* Called at the end of the move process if everything else went ok.
- * @param array $triplets
+ * @param array[] $triplets
*/
protected function cleanupSource( $triplets ) {
// Create source file names from the triplets
* @ingroup FileAbstraction
*/
class OldLocalFile extends LocalFile {
- /** @var string Timestamp */
+ /** @var string|int Timestamp */
protected $requestedTime;
/** @var string Archive name */
/**
* @param Title $title
* @param FileRepo $repo
- * @param null|int $time Timestamp or null
- * @return OldLocalFile
+ * @param string|int $time
+ * @return self
* @throws MWException
*/
static function newFromTitle( $title, $repo, $time = null ) {
* @param Title $title
* @param FileRepo $repo
* @param string $archiveName
- * @return OldLocalFile
+ * @return self
*/
static function newFromArchiveName( $title, $repo, $archiveName ) {
return new self( $title, $repo, null, $archiveName );
/**
* @param stdClass $row
* @param FileRepo $repo
- * @return OldLocalFile
+ * @return self
*/
static function newFromRow( $row, $repo ) {
$title = Title::makeTitle( NS_FILE, $row->oi_name );
/**
* Fields in the oldimage table
* @deprecated since 1.31, use self::getQueryInfo() instead.
- * @return array
+ * @return string[]
*/
static function selectFields() {
global $wgActorTableSchemaMigrationStage;
* @since 1.31
* @param string[] $options
* - omit-lazy: Omit fields that are lazily cached.
- * @return array With three keys:
+ * @return array[] With three keys:
* - tables: (string[]) to include in the `$table` to `IDatabase->select()`
* - fields: (string[]) to include in the `$vars` to `IDatabase->select()`
* - joins: (array) to include in the `$join_conds` to `IDatabase->select()`
/**
* @param Title $title
* @param FileRepo $repo
- * @param string $time Timestamp or null to load by archive name
- * @param string $archiveName Archive name or null to load by timestamp
+ * @param string|int|null $time Timestamp or null to load by archive name
+ * @param string|null $archiveName Archive name or null to load by timestamp
* @throws MWException
*/
function __construct( $title, $repo, $time, $archiveName ) {