diff options
Diffstat (limited to 'includes/filerepo/file')
-rw-r--r-- | includes/filerepo/file/File.php | 68 | ||||
-rw-r--r-- | includes/filerepo/file/ForeignAPIFile.php | 12 | ||||
-rw-r--r-- | includes/filerepo/file/ForeignDBFile.php | 2 | ||||
-rw-r--r-- | includes/filerepo/file/LocalFile.php | 30 | ||||
-rw-r--r-- | includes/filerepo/file/OldLocalFile.php | 4 | ||||
-rw-r--r-- | includes/filerepo/file/UnregisteredLocalFile.php | 16 |
6 files changed, 66 insertions, 66 deletions
diff --git a/includes/filerepo/file/File.php b/includes/filerepo/file/File.php index 793b8967de44..513a934151ef 100644 --- a/includes/filerepo/file/File.php +++ b/includes/filerepo/file/File.php @@ -110,10 +110,10 @@ abstract class File implements IDBAccessObject, MediaHandlerState { * The following member variables are not lazy-initialised */ - /** @var FileRepo|LocalRepo|ForeignAPIRepo|bool */ + /** @var FileRepo|LocalRepo|ForeignAPIRepo|false */ public $repo; - /** @var Title|string|bool */ + /** @var Title|string|false */ protected $title; /** @var string Text of last error */ @@ -125,7 +125,7 @@ abstract class File implements IDBAccessObject, MediaHandlerState { /** @var Title */ protected $redirectedTitle; - /** @var FSFile|bool False if undefined */ + /** @var FSFile|false False if undefined */ protected $fsFile; /** @var MediaHandler */ @@ -182,8 +182,8 @@ abstract class File implements IDBAccessObject, MediaHandlerState { * Most subclasses will want to call assertRepoDefined() here. * * @stable to call - * @param Title|string|bool $title - * @param FileRepo|bool $repo + * @param Title|string|false $title + * @param FileRepo|false $repo */ public function __construct( $title, $repo ) { // Some subclasses do not use $title, but set name/title some other way @@ -199,7 +199,7 @@ abstract class File implements IDBAccessObject, MediaHandlerState { * valid Title object with namespace NS_FILE or null * * @param PageIdentity|LinkTarget|string $title - * @param string|bool $exception Use 'exception' to throw an error on bad titles + * @param string|false $exception Use 'exception' to throw an error on bad titles * @throws MWException * @return Title|null */ @@ -456,7 +456,7 @@ abstract class File implements IDBAccessObject, MediaHandlerState { * returns false. * * @stable to override - * @return string|bool ForeignAPIFile::getPath can return false + * @return string|false ForeignAPIFile::getPath can return false */ public function getPath() { if ( !isset( $this->path ) ) { @@ -472,7 +472,7 @@ abstract class File implements IDBAccessObject, MediaHandlerState { * Returns false on failure. Callers must not alter the file. * Temporary files are cleared automatically. * - * @return string|bool False on failure + * @return string|false False on failure */ public function getLocalRefPath() { $this->assertRepoDefined(); @@ -503,7 +503,7 @@ abstract class File implements IDBAccessObject, MediaHandlerState { * * @stable to override * @param int $page - * @return int|bool + * @return int|false */ public function getWidth( $page = 1 ) { return false; @@ -518,7 +518,7 @@ abstract class File implements IDBAccessObject, MediaHandlerState { * * @stable to override * @param int $page - * @return bool|int False on failure + * @return int|false False on failure */ public function getHeight( $page = 1 ) { return false; @@ -531,7 +531,7 @@ abstract class File implements IDBAccessObject, MediaHandlerState { * * @param int $desiredWidth * @param int $page - * @return bool|int + * @return int|false */ public function getThumbnailBucket( $desiredWidth, $page = 1 ) { $thumbnailBuckets = MediaWikiServices::getInstance() @@ -1049,7 +1049,7 @@ abstract class File implements IDBAccessObject, MediaHandlerState { * * @param array $handlerParams * - * @return ThumbnailImage|MediaTransformOutput|bool False on failure + * @return ThumbnailImage|MediaTransformOutput|false False on failure */ public function getUnscaledThumb( $handlerParams = [] ) { $hp =& $handlerParams; @@ -1172,7 +1172,7 @@ abstract class File implements IDBAccessObject, MediaHandlerState { * @param array $params An associative array of handler-specific parameters. * Typical keys are width, height and page. * @param int $flags A bitfield, may contain self::RENDER_NOW to force rendering - * @return ThumbnailImage|MediaTransformOutput|bool False on failure + * @return ThumbnailImage|MediaTransformOutput|false False on failure */ public function transform( $params, $flags = 0 ) { $thumbnailEpoch = MediaWikiServices::getInstance()->getMainConfig() @@ -1275,7 +1275,7 @@ abstract class File implements IDBAccessObject, MediaHandlerState { * @param TempFSFile $tmpFile Temporary file where the rendered thumbnail will be saved * @param array $transformParams * @param int $flags - * @return bool|MediaTransformOutput + * @return MediaTransformOutput|false */ public function generateAndSaveThumb( $tmpFile, $transformParams, $flags ) { $ignoreImageErrors = MediaWikiServices::getInstance()->getMainConfig() @@ -1538,7 +1538,7 @@ abstract class File implements IDBAccessObject, MediaHandlerState { /** * Get a MediaHandler instance for this file * - * @return MediaHandler|bool Registered MediaHandler for file's MIME type + * @return MediaHandler|false Registered MediaHandler for file's MIME type * or false if none found */ public function getHandler() { @@ -1709,7 +1709,7 @@ abstract class File implements IDBAccessObject, MediaHandlerState { * Get the path of an archived file relative to the public zone root * @stable to override * - * @param bool|string $suffix If not false, the name of an archived thumbnail file + * @param string|false $suffix If not false, the name of an archived thumbnail file * * @return string */ @@ -1729,7 +1729,7 @@ abstract class File implements IDBAccessObject, MediaHandlerState { * thumbnail directory or a particular file if $suffix is specified * @stable to override * - * @param bool|string $suffix If not false, the name of a thumbnail file + * @param string|false $suffix If not false, the name of a thumbnail file * @return string */ public function getThumbRel( $suffix = false ) { @@ -1757,7 +1757,7 @@ abstract class File implements IDBAccessObject, MediaHandlerState { * or a specific thumb if the $suffix is given. * * @param string $archiveName The timestamped name of an archived image - * @param bool|string $suffix If not false, the name of a thumbnail file + * @param string|false $suffix If not false, the name of a thumbnail file * @return string */ private function getArchiveThumbRel( $archiveName, $suffix = false ) { @@ -1772,7 +1772,7 @@ abstract class File implements IDBAccessObject, MediaHandlerState { /** * Get the path of the archived file. * - * @param bool|string $suffix If not false, the name of an archived file. + * @param string|false $suffix If not false, the name of an archived file. * @return string */ public function getArchivePath( $suffix = false ) { @@ -1785,7 +1785,7 @@ abstract class File implements IDBAccessObject, MediaHandlerState { * Get the path of an archived file's thumbs, or a particular thumb if $suffix is specified * * @param string $archiveName The timestamped name of an archived image - * @param bool|string $suffix If not false, the name of a thumbnail file + * @param string|false $suffix If not false, the name of a thumbnail file * @return string */ public function getArchiveThumbPath( $archiveName, $suffix = false ) { @@ -1799,7 +1799,7 @@ abstract class File implements IDBAccessObject, MediaHandlerState { * Get the path of the thumbnail directory, or a particular file if $suffix is specified * @stable to override * - * @param bool|string $suffix If not false, the name of a thumbnail file + * @param string|false $suffix If not false, the name of a thumbnail file * @return string */ public function getThumbPath( $suffix = false ) { @@ -1811,7 +1811,7 @@ abstract class File implements IDBAccessObject, MediaHandlerState { /** * Get the path of the transcoded directory, or a particular file if $suffix is specified * - * @param bool|string $suffix If not false, the name of a media file + * @param string|false $suffix If not false, the name of a media file * @return string */ public function getTranscodedPath( $suffix = false ) { @@ -1824,7 +1824,7 @@ abstract class File implements IDBAccessObject, MediaHandlerState { * Get the URL of the archive directory, or a particular file if $suffix is specified * @stable to override * - * @param bool|string $suffix If not false, the name of an archived file + * @param string|false $suffix If not false, the name of an archived file * @return string */ public function getArchiveUrl( $suffix = false ) { @@ -1845,7 +1845,7 @@ abstract class File implements IDBAccessObject, MediaHandlerState { * @stable to override * * @param string $archiveName The timestamped name of an archived image - * @param bool|string $suffix If not false, the name of a thumbnail file + * @param string|false $suffix If not false, the name of a thumbnail file * @return string */ public function getArchiveThumbUrl( $archiveName, $suffix = false ) { @@ -1864,7 +1864,7 @@ abstract class File implements IDBAccessObject, MediaHandlerState { * Get the URL of the zone directory, or a particular file if $suffix is specified * * @param string $zone Name of requested zone - * @param bool|string $suffix If not false, the name of a file in zone + * @param string|false $suffix If not false, the name of a file in zone * @return string Path */ private function getZoneUrl( $zone, $suffix = false ) { @@ -1882,7 +1882,7 @@ abstract class File implements IDBAccessObject, MediaHandlerState { * Get the URL of the thumbnail directory, or a particular file if $suffix is specified * @stable to override * - * @param bool|string $suffix If not false, the name of a thumbnail file + * @param string|false $suffix If not false, the name of a thumbnail file * @return string Path */ public function getThumbUrl( $suffix = false ) { @@ -1908,7 +1908,7 @@ abstract class File implements IDBAccessObject, MediaHandlerState { /** * Get the URL of the transcoded directory, or a particular file if $suffix is specified * - * @param bool|string $suffix If not false, the name of a media file + * @param string|false $suffix If not false, the name of a media file * @return string Path */ public function getTranscodedUrl( $suffix = false ) { @@ -1919,7 +1919,7 @@ abstract class File implements IDBAccessObject, MediaHandlerState { * Get the public zone virtual URL for a current version source file * @stable to override * - * @param bool|string $suffix If not false, the name of a thumbnail file + * @param string|false $suffix If not false, the name of a thumbnail file * @return string */ public function getVirtualUrl( $suffix = false ) { @@ -1936,7 +1936,7 @@ abstract class File implements IDBAccessObject, MediaHandlerState { * Get the public zone virtual URL for an archived version source file * @stable to override * - * @param bool|string $suffix If not false, the name of a thumbnail file + * @param string|false $suffix If not false, the name of a thumbnail file * @return string */ public function getArchiveVirtualUrl( $suffix = false ) { @@ -1955,7 +1955,7 @@ abstract class File implements IDBAccessObject, MediaHandlerState { * Get the virtual URL for a thumbnail file or directory * @stable to override * - * @param bool|string $suffix If not false, the name of a thumbnail file + * @param string|false $suffix If not false, the name of a thumbnail file * @return string */ public function getThumbVirtualUrl( $suffix = false ) { @@ -2045,7 +2045,7 @@ abstract class File implements IDBAccessObject, MediaHandlerState { * Returns the repository * @stable to override * - * @return FileRepo|bool + * @return FileRepo|false */ public function getRepo() { return $this->repo; @@ -2206,7 +2206,7 @@ abstract class File implements IDBAccessObject, MediaHandlerState { * unknown or not applicable. * * @stable to override - * @return string|bool + * @return string|false */ public function getDescriptionUrl() { if ( $this->repo ) { @@ -2302,7 +2302,7 @@ abstract class File implements IDBAccessObject, MediaHandlerState { * Get the 14-character timestamp of the file upload * * @stable to override - * @return string|bool TS_MW timestamp or false on failure + * @return string|false TS_MW timestamp or false on failure */ public function getTimestamp() { $this->assertRepoDefined(); @@ -2316,7 +2316,7 @@ abstract class File implements IDBAccessObject, MediaHandlerState { * would be expensive. * @since 1.25 * @stable to override - * @return string|bool + * @return string|false */ public function getDescriptionTouched() { return false; diff --git a/includes/filerepo/file/ForeignAPIFile.php b/includes/filerepo/file/ForeignAPIFile.php index aa5d42f1e25c..3bfbf5f0290d 100644 --- a/includes/filerepo/file/ForeignAPIFile.php +++ b/includes/filerepo/file/ForeignAPIFile.php @@ -37,7 +37,7 @@ class ForeignAPIFile extends File { protected $repoClass = ForeignAPIRepo::class; /** - * @param Title|string|bool $title + * @param Title|string|false $title * @param ForeignApiRepo $repo * @param array $info * @param bool $exists @@ -95,7 +95,7 @@ class ForeignAPIFile extends File { } /** - * @return ForeignAPIRepo|bool + * @return ForeignAPIRepo|false */ public function getRepo() { return $this->repo; @@ -120,7 +120,7 @@ class ForeignAPIFile extends File { /** * @param array $params * @param int $flags - * @return bool|MediaTransformOutput + * @return MediaTransformOutput|false */ public function transform( $params, $flags = 0 ) { if ( !$this->canRender() ) { @@ -245,7 +245,7 @@ class ForeignAPIFile extends File { } /** - * @return bool|int|null + * @return int|null|false */ public function getSize() { return isset( $this->mInfo['size'] ) ? intval( $this->mInfo['size'] ) : null; @@ -305,7 +305,7 @@ class ForeignAPIFile extends File { } /** - * @return bool|string + * @return string|false */ public function getTimestamp() { return wfTimestamp( TS_MW, @@ -340,7 +340,7 @@ class ForeignAPIFile extends File { } /** - * @return bool|string + * @return string|false */ public function getDescriptionUrl() { return $this->mInfo['descriptionurl'] ?? false; diff --git a/includes/filerepo/file/ForeignDBFile.php b/includes/filerepo/file/ForeignDBFile.php index f2afeac02be6..c8a2d690cc41 100644 --- a/includes/filerepo/file/ForeignDBFile.php +++ b/includes/filerepo/file/ForeignDBFile.php @@ -30,7 +30,7 @@ use Wikimedia\Rdbms\DBUnexpectedError; class ForeignDBFile extends LocalFile { /** - * @return ForeignDBRepo|bool + * @return ForeignDBRepo|false */ public function getRepo() { return $this->repo; diff --git a/includes/filerepo/file/LocalFile.php b/includes/filerepo/file/LocalFile.php index c67f8639c35a..9d067eb15c67 100644 --- a/includes/filerepo/file/LocalFile.php +++ b/includes/filerepo/file/LocalFile.php @@ -227,8 +227,8 @@ class LocalFile extends File { * * @param string $sha1 Base-36 SHA-1 * @param LocalRepo $repo - * @param string|bool $timestamp MW_timestamp (optional) - * @return bool|LocalFile + * @param string|false $timestamp MW_timestamp (optional) + * @return static|false */ public static function newFromKey( $sha1, $repo, $timestamp = false ) { $dbr = $repo->getReplicaDB(); @@ -325,7 +325,7 @@ class LocalFile extends File { } /** - * @return LocalRepo|bool + * @return LocalRepo|false */ public function getRepo() { return $this->repo; @@ -335,7 +335,7 @@ class LocalFile extends File { * Get the memcached key for the main data for this file, or false if * there is no access to the shared cache. * @stable to override - * @return string|bool + * @return string|false */ protected function getCacheKey() { return $this->repo->getSharedCacheKey( 'file', sha1( $this->getName() ) ); @@ -560,7 +560,7 @@ class LocalFile extends File { /** * @param IDatabase $dbr * @param string $fname - * @return string[]|bool + * @return string[]|false */ private function loadExtraFieldsWithTimestamp( $dbr, $fname ) { $fieldMap = false; @@ -1304,7 +1304,7 @@ class LocalFile extends File { /** * Get all thumbnail names previously generated for this file * @stable to override - * @param string|bool $archiveName Name of an archive file, default false + * @param string|false $archiveName Name of an archive file, default false * @return array First element is the base dir, then files in that base dir. */ protected function getThumbnails( $archiveName = false ) { @@ -1575,7 +1575,7 @@ class LocalFile extends File { * 1 query for old versions, return first one * 2, ... return next old version from above query * @stable to override - * @return stdClass|bool + * @return stdClass|false */ public function nextHistoryLine() { if ( !$this->exists() ) { @@ -1651,11 +1651,11 @@ class LocalFile extends File { * @param string $comment Upload description * @param string $pageText Text to use for the new description page, * if a new description page is created - * @param int|bool $flags Flags for publish() - * @param array|bool $props File properties, if known. This can be used to + * @param int $flags Flags for publish() + * @param array|false $props File properties, if known. This can be used to * reduce the upload time when uploading virtual URLs for which the file * info is already known - * @param string|bool $timestamp Timestamp for img_timestamp, or false to use the + * @param string|false $timestamp Timestamp for img_timestamp, or false to use the * current time. Can be in any format accepted by ConvertibleTimestamp. * @param Authority|null $uploader object or null to use the context authority * @param string[] $tags Change tags to add to the log entry and page revision. @@ -1761,8 +1761,8 @@ class LocalFile extends File { * @param string $comment * @param string $pageText * @param Authority $performer - * @param bool|array $props - * @param string|bool $timestamp Can be in any format accepted by ConvertibleTimestamp + * @param array|false $props + * @param string|false $timestamp Can be in any format accepted by ConvertibleTimestamp * @param string[] $tags * @param bool $createNullRevision Set to false to avoid creation of a null revision on file * upload, see T193621 @@ -2427,7 +2427,7 @@ class LocalFile extends File { /** * Get the URL of the file description page. * @stable to override - * @return string|bool + * @return string|false */ public function getDescriptionUrl() { if ( !$this->title ) { @@ -2513,7 +2513,7 @@ class LocalFile extends File { /** * @stable to override - * @return bool|string TS_MW timestamp, a string with 14 digits + * @return string|false TS_MW timestamp, a string with 14 digits */ public function getTimestamp() { $this->load(); @@ -2523,7 +2523,7 @@ class LocalFile extends File { /** * @stable to override - * @return bool|string + * @return string|false */ public function getDescriptionTouched() { if ( !$this->exists() ) { diff --git a/includes/filerepo/file/OldLocalFile.php b/includes/filerepo/file/OldLocalFile.php index abf9e99f4ee1..cbb5aa719baa 100644 --- a/includes/filerepo/file/OldLocalFile.php +++ b/includes/filerepo/file/OldLocalFile.php @@ -90,9 +90,9 @@ class OldLocalFile extends LocalFile { * * @param string $sha1 Base-36 SHA-1 * @param LocalRepo $repo - * @param string|bool $timestamp MW_timestamp (optional) + * @param string|false $timestamp MW_timestamp (optional) * - * @return bool|OldLocalFile + * @return static|false */ public static function newFromKey( $sha1, $repo, $timestamp = false ) { $dbr = $repo->getReplicaDB(); diff --git a/includes/filerepo/file/UnregisteredLocalFile.php b/includes/filerepo/file/UnregisteredLocalFile.php index 4a104d01d16a..4c91bdbfed06 100644 --- a/includes/filerepo/file/UnregisteredLocalFile.php +++ b/includes/filerepo/file/UnregisteredLocalFile.php @@ -41,7 +41,7 @@ class UnregisteredLocalFile extends File { /** @var string */ protected $path; - /** @var bool|string */ + /** @var string|false */ protected $mime; /** @var array[]|bool[] Dimension data */ @@ -76,10 +76,10 @@ class UnregisteredLocalFile extends File { * A FileRepo object is not required here, unlike most other File classes. * * @throws MWException - * @param Title|bool $title - * @param FileRepo|bool $repo - * @param string|bool $path - * @param string|bool $mime + * @param Title|false $title + * @param FileRepo|false $repo + * @param string|false $path + * @param string|false $mime */ public function __construct( $title = false, $repo = false, $path = false, $mime = false ) { if ( !( $title && $repo ) && !$path ) { @@ -109,7 +109,7 @@ class UnregisteredLocalFile extends File { /** * @param int $page - * @return array|bool + * @return array|false */ private function cachePageDimensions( $page = 1 ) { $page = (int)$page; @@ -156,7 +156,7 @@ class UnregisteredLocalFile extends File { } /** - * @return bool|string + * @return string|false */ public function getMimeType() { if ( !isset( $this->mime ) ) { @@ -202,7 +202,7 @@ class UnregisteredLocalFile extends File { } /** - * @return bool|string + * @return string|false */ public function getURL() { if ( $this->repo ) { |