* @param Title $title Optional title object for the category represented by
* the given row. May be provided if it is already known, to avoid having
* to re-create a title object later.
- * @return Category
+ * @return Category|false
*/
public static function newFromRow( $row, $title = null ) {
$cat = new self();
/** @var bool Has a summary been preset using GET parameter &summary= ? */
public $hasPresetSummary = false;
- /** @var bool */
+ /** @var Revision|bool */
public $mBaseRevision = false;
/** @var bool */
protected $cache = [];
/**
- * Map of repo URLs to viewer URLs. Access via static method getViewers().
+ * @var array|false Map of repo URLs to viewer URLs. Access via static method getViewers().
*/
private static $viewers = false;
* @param string $url Either fully-qualified or a local path + query
* @param string $defaultProto One of the PROTO_* constants. Determines the
* protocol to use if $url or $wgServer is protocol-relative
- * @return string Fully-qualified URL, current-path-relative URL or false if
+ * @return string|false Fully-qualified URL, current-path-relative URL or false if
* no valid URL can be constructed
*/
function wfExpandUrl( $url, $defaultProto = PROTO_CURRENT ) {
}
/**
- * @return string
+ * @return string|false
*/
function getText() {
if ( isset( self::$blobCache[$this->mOldId] ) ) {
* if there isn't one. This is used by Skin to determine whether to enable
* JavaScript frame-breaking, for clients that don't support X-Frame-Options.
*
- * @return string
+ * @return string|false
*/
public function getFrameOptions() {
$config = $this->getConfig();
* difference between a $1 that was not replaced and a $1 that was part of
* the content a $1 was replaced with.
* @param string $value
- * @return string
+ * @return string|false
*/
public function replace( $value ) {
$this->error = false;
*
* @param string $action
*
- * @return string 14-char timestamp or "infinity", or false if the input was invalid
+ * @return string|false 14-char timestamp or "infinity", or false if the input was invalid
*/
function getExpiry( $action ) {
if ( $this->mExpirySelection[$action] == 'existing' ) {
/**
* Fetch revision's user id without regard for the current user's permissions
*
- * @return string
+ * @return int
* @deprecated since 1.25, use getUser( Revision::RAW )
*/
public function getRawUser() {
* (same as the the wiki $row was loaded from) or false to indicate the local
* wiki (this is the default). Otherwise, it must be a symbolic wiki database
* identifier as understood by the LoadBalancer class.
- * @return string Text the text requested or false on failure
+ * @return string|false Text the text requested or false on failure
*/
public static function getRevisionText( $row, $prefix = 'old_', $wiki = false ) {
* @param string $from
* @param string $to
* @param string|array $in
- * @return string
+ * @return string|array
*/
function doReplace( $from, $to, $in ) {
if ( is_string( $in ) ) {
/**
* Returns the DB name of the distant wiki which owns the object.
*
- * @return string The DB name
+ * @return string|false The DB name
*/
public function getTransWikiID() {
if ( !$this->isExternal() ) {
/**
* Get the namespace text
*
- * @return string Namespace text
+ * @return string|false Namespace text
*/
public function getNsText() {
if ( $this->isExternal() ) {
* Get the last touched timestamp
*
* @param IDatabase $db Optional db
- * @return string Last-touched timestamp
+ * @return string|false Last-touched timestamp
*/
public function getTouched( $db = null ) {
if ( $db === null ) {
* This is for use prior to Setup.php, when no WebRequest object is available.
* At other times, use the non-static function getProtocol().
*
- * @return array
+ * @return string
*/
public static function detectProtocol() {
if ( ( !empty( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] !== 'off' ) ||
* @param string $wikiID Wiki'd id (generally database name)
* @param string $page Page name (must be normalised before calling this function!)
* @param string $text Link's text; optional, default to $page
- * @return string HTML link or false if the wiki was not found
+ * @return string|false HTML link or false if the wiki was not found
*/
public static function makeForeignLink( $wikiID, $page, $text = null ) {
if ( !$text ) {
* "apihelp-{$this->getModulePath()}-description".
*
* @deprecated since 1.25
- * @return Message|string|array
+ * @return Message|string|array|false
*/
protected function getDescription() {
return false;
/**
* @param ApiBase $module
- * @return ApiResult
+ * @return array
*/
private function getModuleInfo( $module ) {
$ret = [];
* @return bool
*/
public function validateSha1Hash( $hash ) {
- return preg_match( '/^[a-f0-9]{40}$/', $hash );
+ return (bool)preg_match( '/^[a-f0-9]{40}$/', $hash );
}
/**
* @return bool
*/
public function validateSha1Base36Hash( $hash ) {
- return preg_match( '/^[a-z0-9]{31}$/', $hash );
+ return (bool)preg_match( '/^[a-z0-9]{31}$/', $hash );
}
/**
*/
private function validateHexSortkey( $hexSortkey ) {
// A hex sortkey has an unbound number of 2 letter pairs
- return preg_match( '/^(?:[a-fA-F0-9]{2})*$/D', $hexSortkey );
+ return (bool)preg_match( '/^(?:[a-fA-F0-9]{2})*$/D', $hexSortkey );
}
/**
* @param Content $content Edit content
* @param User $user
* @param string $summary Edit summary
- * @return integer ApiStashEdit::ERROR_* constant
+ * @return string ApiStashEdit::ERROR_* constant
* @since 1.25
*/
public static function parseAndStash( WikiPage $page, Content $content, User $user, $summary ) {
/**
* Save and compress text to the cache
* @param string $text
- * @return string Compressed text
+ * @return string|false Compressed text
*/
public function saveText( $text ) {
if ( $this->useGzip() ) {
* array.
* @param string $code
* @param string $key
- * @return bool|null|string
+ * @return bool|null|string|string[]
*/
public function getSubitemList( $code, $key ) {
if ( in_array( $key, self::$splitKeys ) ) {
}
/**
- * @return string
+ * @return string|int
*/
public function lastErrno() {
$err = sqlsrv_errors( SQLSRV_ERR_ALL );
*
* @param array|string $table
* @param string $field
- * @return ORAField|ORAResult
+ * @return ORAField|ORAResult|false
*/
private function fieldInfoMulti( $table, $field ) {
$field = strtoupper( $field );
if ( is_nan( $item ) ) {
return 'NaN';
}
- return $item;
+ return (string)$item;
}
if ( is_scalar( $item ) ) {
/**
* @param int $i
- * @return string|null
+ * @return string[]|string|null
*/
public function getClosing( $i = null ) {
if ( $i === null ) {
if ( $link ) {
return "[$link $id]";
} else {
- return $id;
+ return (string)$id;
}
}
*/
protected $pathDisclosureProtection = 'simple';
- /** @var bool Public zone URL. */
+ /** @var string|false Public zone URL. */
protected $url;
/** @var string The base thumbnail URL. Defaults to "<url>/thumb". */
* @return bool Whether non-ASCII path characters are allowed
*/
public function backendSupportsUnicodePaths() {
- return ( $this->getBackend()->getFeatures() & FileBackend::ATTR_UNICODE_PATHS );
+ return (bool)( $this->getBackend()->getFeatures() & FileBackend::ATTR_UNICODE_PATHS );
}
/**
* constructor, whereas local repositories use the local Title functions.
*
* @param string $name
- * @return string
+ * @return string|false
*/
public function getDescriptionUrl( $name ) {
$encName = wfUrlencode( $name );
*
* @param string $name Name of image to fetch
* @param string $lang Language to fetch it in, if any.
- * @return string
+ * @return string|false
*/
public function getDescriptionRenderUrl( $name, $lang = null ) {
$query = 'action=render';
*
* @param Title $title
* @param string|bool $time
- * @return File
+ * @return File|false
*/
function newFile( $title, $time = false ) {
if ( $time ) {
/**
* Get the repo instance by its name
* @param string $name
- * @return bool
+ * @return FileRepo|bool
*/
function getRepoByName( $name ) {
if ( !$this->reposInitialised ) {
/** @var string SHA-1 hash of file content */
private $sha1;
- /** @var string Number of pages of a multipage document, or false for
+ /** @var int|false Number of pages of a multipage document, or false for
* documents which aren't multipage documents
*/
private $pageCount;
* Return the user name of the uploader.
*
* @deprecated since 1.23 Use getUser( 'text' ) instead.
- * @return string
+ * @return string|int
*/
public function getUserText() {
wfDeprecated( __METHOD__, '1.23' );
/**
* Return upload description.
*
- * @return string
+ * @return string|int
*/
public function getDescription() {
$this->load();
/** @var string Relative path including trailing slash */
protected $hashPath;
- /** @var string Number of pages of a multipage document, or false for
+ /** @var string|false Number of pages of a multipage document, or false for
* documents which aren't multipage documents
*/
protected $pageCount;
/**
* Get the duration of a media file in seconds
*
- * @return int
+ * @return float|int
*/
public function getLength() {
$handler = $this->getHandler();
*
* @param array $handlerParams
*
- * @return string
+ * @return ThumbnailImage|MediaTransformOutput|bool False on failure
*/
function getUnscaledThumb( $handlerParams = [] ) {
$hp =& $handlerParams;
* Returns the number of pages of a multipage document, or false for
* documents which aren't multipage documents
*
- * @return bool|int
+ * @return string|bool|int
*/
function pageCount() {
if ( !isset( $this->pageCount ) ) {
if ( $srcWidth == 0 ) {
return 0;
} else {
- return round( $srcHeight * $dstWidth / $srcWidth );
+ return (int)round( $srcHeight * $dstWidth / $srcWidth );
}
}
* a good reason. This method skips all caches.
*
* @param string $filePath The path to the file (e.g. From getLocalPathRef() )
- * @return array The width, followed by height, with optionally more things after
+ * @return array|false The width, followed by height, with optionally more things after
*/
function getImageSize( $filePath ) {
if ( !$this->getHandler() ) {
* Get the HTML text of the description page, if available
*
* @param bool|Language $lang Optional language to fetch description in
- * @return string
+ * @return string|false
*/
function getDescriptionText( $lang = false ) {
global $wgLang;
/**
* Get the deletion archive key, "<sha1>.<ext>"
*
- * @return string
+ * @return string|false
*/
function getStorageKey() {
$hash = $this->getSha1();
/**
* @param bool|Language $lang Optional language to fetch description in.
- * @return string
+ * @return string|false
*/
function getDescriptionText( $lang = false ) {
global $wgLang;
* with integer 0 as a value.
*
* @param array $array
- * @return array
+ * @return array|string
*/
public static function forceToStringRecursive( $array ) {
if ( is_array( $array ) ) {
$request = $this->mParent
? $this->mParent->getRequest()
: RequestContext::getMain()->getRequest();
- return preg_match( '/MSIE [1-7]\./i', $request->getHeader( 'User-Agent' ) );
+ return (bool)preg_match( '/MSIE [1-7]\./i', $request->getHeader( 'User-Agent' ) );
}
}
/**
* @param WebRequest $request
*
- * @return string
+ * @return string|array
*/
public function loadDataFromRequest( $request ) {
if ( $this->isSubmitAttempt( $request ) ) {
/**
* @param WebRequest $request
*
- * @return string
+ * @return string|int
*/
public function loadDataFromRequest( $request ) {
$size = $request->getInt( $this->mName );
* @return bool
*/
public static function isValidURI( $uri ) {
- return preg_match(
+ return (bool)preg_match(
'/^https?:\/\/[^\/\s]\S*$/D',
$uri
);
/**
* Determine if LocalSettings.php exists. If it does, return its variables.
*
- * @return array
+ * @return array|false
*/
public static function getExistingLocalSettings() {
global $IP;
/**
* Convert a hex string representing a Unicode code point to that code point.
* @param string $c
- * @return string
+ * @return string|false
*/
protected function unicodeChar( $c ) {
$c = hexdec( $c );
*
* @param string $string
*
- * @return string
+ * @return string|false
*/
public static function escapePhpString( $string ) {
if ( is_array( $string ) || is_object( $string ) ) {
* @note More logic is explained in DefaultSettings.
*
* @param string $prefix Interwiki prefix
- * @return Interwiki
+ * @return Interwiki|false
*/
private function getInterwikiCached( $prefix ) {
$value = $this->getInterwikiCacheEntry( $prefix );
/**
* @param string $name
- * @return string
+ * @return string[]
*/
private function decodeQueueName( $name ) {
list( $type, $wiki ) = explode( '/', $name, 2 );
// The position after the end of the next delimiter
private $endPos;
- // The current token
+ /** @var string|false The current token */
private $current;
/**
/** @var Array (location => (start, end)) */
protected $ring = [];
- /** @var Array (location => (start, end)) */
+ /** @var HashRing|null */
protected $liveRing;
/** @var Array (location => UNIX timestamp) */
protected $ejectionExpiries = [];
/**
* @see FileBackendStore::getFileXAttributes()
* @param array $params
- * @return bool|string
+ * @return array[][]
*/
protected function doGetFileXAttributes( array $params ) {
return [ 'headers' => [], 'metadata' => [] ]; // not supported
* @param array $creds From getAuthentication()
* @param string $container
* @param string $object
- * @return array
+ * @return string
*/
protected function storageUrl( array $creds, $container = null, $object = null ) {
$parts = [ $creds['storage_url'] ];
/**
* @param string $key
- * @return array|null
+ * @return string|null
*/
public function getMessage( $key ) {
return self::$dataCache->getSubitem( $this->mCode, 'messages', $key );