file: Fix nullable documentation for property, args and return types

Change documentation to null or false where the type is allowed

Change-Id: I7c9a612adabf47da8ce11265907702ad5d83699a
This commit is contained in:
Umherirrender 2021-10-16 23:05:28 +02:00 committed by Thiemo Kreuz (WMDE)
parent 42d554c930
commit b914247380
8 changed files with 17 additions and 17 deletions

View file

@ -511,8 +511,8 @@ class ForeignAPIRepo extends FileRepo {
* @param string $url
* @param string $timeout
* @param array $options
* @param int|bool &$mtime Resulting Last-Modified UNIX timestamp if received
* @return bool|string
* @param int|false &$mtime Resulting Last-Modified UNIX timestamp if received
* @return string|false
*/
public static function httpGet(
$url, $timeout = 'default', $options = [], &$mtime = false

View file

@ -18,7 +18,7 @@ interface LocalFilePurgeThumbnailsHook {
* @since 1.35
*
* @param File $file The File of which the thumbnails are being purged
* @param string $archiveName Name of an old file version or false if it's the current one
* @param string|false $archiveName Name of an old file version or false if it's the current one
* @param array $urls Urls to be purged
* @return bool|void True or no return value to continue or false to abort
*/

View file

@ -101,7 +101,7 @@ class ArchivedFile {
/** @var MediaHandler */
protected $handler;
/** @var Title */
/** @var Title|null */
protected $title; # image title
/** @var bool */
@ -110,14 +110,14 @@ class ArchivedFile {
/**
* @stable to call
* @throws MWException
* @param Title $title
* @param Title|null $title
* @param int $id
* @param string $key
* @param string $sha1
*/
public function __construct( $title, $id = 0, $key = '', $sha1 = '' ) {
$this->id = -1;
$this->title = false;
$this->title = null;
$this->name = false;
$this->group = 'deleted'; // needed for direct use of constructor
$this->key = '';

View file

@ -136,13 +136,13 @@ abstract class File implements IDBAccessObject, MediaHandlerState {
/** @var string File extension */
protected $extension;
/** @var string The name of a file from its title object */
/** @var string|null The name of a file from its title object */
protected $name;
/** @var string The storage path corresponding to one of the zones */
protected $path;
/** @var string Relative path including trailing slash */
/** @var string|null Relative path including trailing slash */
protected $hashPath;
/** @var int|false Number of pages of a multipage document, or false for
@ -150,7 +150,7 @@ abstract class File implements IDBAccessObject, MediaHandlerState {
*/
protected $pageCount;
/** @var string URL of transformscript (for example thumb.php) */
/** @var string|false URL of transformscript (for example thumb.php) */
protected $transformScript;
/** @var Title */
@ -1041,7 +1041,7 @@ abstract class File implements IDBAccessObject, MediaHandlerState {
}
/**
* @return string
* @return string|false
*/
private function getTransformScript() {
if ( !isset( $this->transformScript ) ) {
@ -1553,7 +1553,7 @@ abstract class File implements IDBAccessObject, MediaHandlerState {
/**
* Get a ThumbnailImage representing a file type icon
*
* @return ThumbnailImage
* @return ThumbnailImage|null
*/
public function iconThumb() {
global $wgResourceBasePath, $IP;
@ -2123,7 +2123,7 @@ abstract class File implements IDBAccessObject, MediaHandlerState {
*
* May throw database exceptions on error.
*
* @param array $versions Set of record ids of deleted items to restore,
* @param int[] $versions Set of record ids of deleted items to restore,
* or empty to restore all revisions.
* @param bool $unsuppress Remove restrictions on content upon restoration?
* @return Status

View file

@ -51,7 +51,7 @@ class ForeignDBFile extends LocalFile {
}
/**
* @param array $versions
* @param int[] $versions
* @param bool $unsuppress
* @return Status
* @throws MWException
@ -145,7 +145,7 @@ class ForeignDBFile extends LocalFile {
/**
* Get short description URL for a file based on the page ID.
*
* @return string
* @return string|null
* @throws DBUnexpectedError
* @since 1.27
*/

View file

@ -2477,7 +2477,7 @@ class LocalFile extends File {
* May throw database exceptions on error.
* @stable to override
*
* @param array $versions Set of record ids of deleted items to restore,
* @param int[] $versions Set of record ids of deleted items to restore,
* or empty to restore all revisions.
* @param bool $unsuppress
* @return Status

View file

@ -34,7 +34,7 @@ class LocalFileRestoreBatch {
/** @var string[] List of file IDs to restore */
private $cleanupBatch;
/** @var string[] List of file IDs to restore */
/** @var int[] List of file IDs to restore */
private $ids;
/** @var bool Add all revisions of the file */

View file

@ -102,7 +102,7 @@ trait MediaFileTrait {
/**
* @param File $file
* @param int $duration File duration (if any)
* @param int|null $duration File duration (if any)
* @param int $maxWidth Max width to display at
* @param int $maxHeight Max height to display at
* @return array|null Transform info ready to include in response, or null if unavailable