From f3cc77aaeeb4f3a93fde7de80dbaafd89f6bd2bf Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Thu, 9 Feb 2012 17:41:50 +0000 Subject: [PATCH] Fixing some of the "@return true" or "@return false", need to be "@return bool" and then the metadata can say true if foo, false if bar Other documentation improvements --- includes/LinkFilter.php | 2 +- includes/Namespace.php | 2 +- includes/Setup.php | 4 ++-- includes/SquidPurgeClient.php | 2 +- includes/StreamFile.php | 4 ++-- includes/Title.php | 3 +-- includes/User.php | 6 +++--- includes/WikiMap.php | 2 +- includes/libs/IEUrlExtension.php | 4 ++-- includes/media/Generic.php | 4 ++-- includes/media/MediaTransformOutput.php | 6 +++--- includes/media/SVG.php | 2 +- includes/media/XCF.php | 2 +- includes/objectcache/BagOStuff.php | 2 +- includes/parser/Parser.php | 4 ++-- includes/parser/ParserCache.php | 4 ++-- includes/revisiondelete/RevisionDeleteAbstracts.php | 4 ++-- includes/revisiondelete/RevisionDeleteUser.php | 4 ++-- includes/specials/SpecialDeadendpages.php | 4 ++-- 19 files changed, 32 insertions(+), 33 deletions(-) diff --git a/includes/LinkFilter.php b/includes/LinkFilter.php index af7680fb05..f1e19f9df4 100644 --- a/includes/LinkFilter.php +++ b/includes/LinkFilter.php @@ -120,7 +120,7 @@ class LinkFilter { * Filters an array returned by makeLikeArray(), removing everything past first pattern placeholder. * * @param $arr array: array to filter - * @return filtered array + * @return array filtered array */ public static function keepOneWildcard( $arr ) { if( !is_array( $arr ) ) { diff --git a/includes/Namespace.php b/includes/Namespace.php index 292559d0f2..e536d8b0f1 100644 --- a/includes/Namespace.php +++ b/includes/Namespace.php @@ -33,7 +33,7 @@ class MWNamespace { * @param $index * @param $method * - * @return true + * @return bool */ private static function isMethodValidFor( $index, $method ) { if ( $index < NS_MAIN ) { diff --git a/includes/Setup.php b/includes/Setup.php index 1cf171ae7a..a9cf38189f 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -483,7 +483,7 @@ $wgRequest->interpolateTitle(); $wgUser = RequestContext::getMain()->getUser(); # BackCompat /** - * @var Language + * @var $wgLang Language */ $wgLang = new StubUserLang; @@ -493,7 +493,7 @@ $wgLang = new StubUserLang; $wgOut = RequestContext::getMain()->getOutput(); # BackCompat /** - * @var Parser + * @var $wgParser Parser */ $wgParser = new StubObject( 'wgParser', $wgParserConf['class'], array( $wgParserConf ) ); diff --git a/includes/SquidPurgeClient.php b/includes/SquidPurgeClient.php index 506ada96d1..b0418bac60 100644 --- a/includes/SquidPurgeClient.php +++ b/includes/SquidPurgeClient.php @@ -34,7 +34,7 @@ class SquidPurgeClient { * Open a socket if there isn't one open already, return it. * Returns false on error. * - * @return false|resource + * @return bool|resource */ protected function getSocket() { if ( $this->socket !== null ) { diff --git a/includes/StreamFile.php b/includes/StreamFile.php index 0de03c8324..ce13a21f42 100644 --- a/includes/StreamFile.php +++ b/includes/StreamFile.php @@ -41,10 +41,10 @@ class StreamFile { * (c) sends Content-Length header based on HTTP_IF_MODIFIED_SINCE check * * @param $path string Storage path or file system path - * @param $info Array|false File stat info with 'mtime' and 'size' fields + * @param $info Array|bool File stat info with 'mtime' and 'size' fields * @param $headers Array Additional headers to send * @param $sendErrors bool Send error messages if errors occur (like 404) - * @return int|false READY_STREAM, NOT_MODIFIED, or false on failure + * @return int|bool READY_STREAM, NOT_MODIFIED, or false on failure */ public static function prepareForStream( $path, $info, $headers = array(), $sendErrors = true diff --git a/includes/Title.php b/includes/Title.php index b7eea8b242..f8feb2441e 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -2020,9 +2020,8 @@ class Title { $name = $this->getPrefixedText(); $dbName = $this->getPrefixedDBKey(); - // Check with and without underscores + // Check for explicit whitelisting with and without underscores if ( in_array( $name, $wgWhitelistRead, true ) || in_array( $dbName, $wgWhitelistRead, true ) ) { - # Check for explicit whitelisting $whitelisted = true; } elseif ( $this->getNamespace() == NS_MAIN ) { # Old settings might have the title prefixed with diff --git a/includes/User.php b/includes/User.php index c56e2ffdee..52fe08ef25 100644 --- a/includes/User.php +++ b/includes/User.php @@ -3376,7 +3376,7 @@ class User { * * @note Call saveSettings() after calling this function to commit the change. * - * @return true + * @return bool */ public function confirmEmail() { $this->setEmailAuthenticationTimestamp( wfTimestampNow() ); @@ -3389,7 +3389,7 @@ class User { * address if it was already confirmed. * * @note Call saveSettings() after calling this function to commit the change. - * @return true + * @return bool */ function invalidateEmail() { $this->load(); @@ -3957,7 +3957,7 @@ class User { * Add an autocreate newuser log entry for this user * Used by things like CentralAuth and perhaps other authplugins. * - * @return true + * @return bool */ public function addNewUserLogEntryAutoCreate() { global $wgNewUserLog; diff --git a/includes/WikiMap.php b/includes/WikiMap.php index 6c7f23b52f..91e91f96a5 100644 --- a/includes/WikiMap.php +++ b/includes/WikiMap.php @@ -34,7 +34,7 @@ class WikiMap { * * @todo We can give more info than just the wiki id! * @param $wikiID String: wiki'd id (generally database name) - * @return Wiki's name or $wiki_id if the wiki was not found + * @return string|int Wiki's name or $wiki_id if the wiki was not found */ public static function getWikiName( $wikiID ) { $wiki = WikiMap::getWiki( $wikiID ); diff --git a/includes/libs/IEUrlExtension.php b/includes/libs/IEUrlExtension.php index e00e666385..dcdf7b3557 100644 --- a/includes/libs/IEUrlExtension.php +++ b/includes/libs/IEUrlExtension.php @@ -35,8 +35,8 @@ class IEUrlExtension { * * If the a variable is unset in $_SERVER, it should be unset in $vars. * - * @param $vars A subset of $_SERVER. - * @param $extWhitelist Extensions which are allowed, assumed harmless. + * @param $vars array A subset of $_SERVER. + * @param $extWhitelist array Extensions which are allowed, assumed harmless. * @return bool */ public static function areServerVarsBad( $vars, $extWhitelist = array() ) { diff --git a/includes/media/Generic.php b/includes/media/Generic.php index 271d3a8dbc..d74b1da1e0 100644 --- a/includes/media/Generic.php +++ b/includes/media/Generic.php @@ -484,7 +484,7 @@ abstract class MediaHandler { * * @param $dstPath The location of the suspect file * @param $retval Return value of some shell process, file will be deleted if this is non-zero - * @return true if removed, false otherwise + * @return bool if removed, false otherwise */ function removeBadFile( $dstPath, $retval = 0 ) { if( file_exists( $dstPath ) ) { @@ -652,7 +652,7 @@ abstract class ImageHandler extends MediaHandler { * @param $srcWidth Integer: width of the source image * @param $srcHeight Integer: height of the source image * @param $mimeType Unused - * @return false to indicate that an error should be returned to the user. + * @return bool to indicate that an error should be returned to the user. */ function validateThumbParams( &$width, &$height, $srcWidth, $srcHeight, $mimeType ) { $width = intval( $width ); diff --git a/includes/media/MediaTransformOutput.php b/includes/media/MediaTransformOutput.php index fcfb2f45b4..ed2ba8ca89 100644 --- a/includes/media/MediaTransformOutput.php +++ b/includes/media/MediaTransformOutput.php @@ -42,7 +42,7 @@ abstract class MediaTransformOutput { } /** - * @return string|false The permanent thumbnail storage path + * @return string|bool The permanent thumbnail storage path */ public function getStoragePath() { return $this->storagePath; @@ -113,7 +113,7 @@ abstract class MediaTransformOutput { * Get the path of a file system copy of the thumbnail. * Callers should never write to this path. * - * @return string|false Returns false if there isn't one + * @return string|bool Returns false if there isn't one */ public function getLocalCopyPath() { if ( $this->isError() ) { @@ -187,7 +187,7 @@ class ThumbnailImage extends MediaTransformOutput { * @param $url String: URL path to the thumb * @param $width Integer: file's width * @param $height Integer: file's height - * @param $path String|false|null: filesystem path to the thumb + * @param $path String|bool|null: filesystem path to the thumb * @param $page Integer: page number, for multipage files * @private */ diff --git a/includes/media/SVG.php b/includes/media/SVG.php index aac838e165..5e72ab0a6b 100644 --- a/includes/media/SVG.php +++ b/includes/media/SVG.php @@ -119,7 +119,7 @@ class SvgHandler extends ImageHandler { * @param string $dstPath * @param string $width * @param string $height - * @return true|MediaTransformError + * @return bool|MediaTransformError */ public function rasterize( $srcPath, $dstPath, $width, $height ) { global $wgSVGConverters, $wgSVGConverter, $wgSVGConverterPath; diff --git a/includes/media/XCF.php b/includes/media/XCF.php index 806db73cd7..ce712903ac 100644 --- a/includes/media/XCF.php +++ b/includes/media/XCF.php @@ -58,7 +58,7 @@ class XCFHandler extends BitmapHandler { * @author Hashar * * @param $filename String Full path to a XCF file - * @return false|metadata array just like PHP getimagesize() + * @return bool|array metadata array just like PHP getimagesize() */ static function getXCFMetaData( $filename ) { # Decode master structure diff --git a/includes/objectcache/BagOStuff.php b/includes/objectcache/BagOStuff.php index 81ad662168..6b73be7b86 100644 --- a/includes/objectcache/BagOStuff.php +++ b/includes/objectcache/BagOStuff.php @@ -98,7 +98,7 @@ abstract class BagOStuff { * regularly during long-running operations with the percentage progress * as the first parameter. * - * @return true on success, false if unimplemented + * @return bool on success, false if unimplemented */ public function deleteObjectsExpiringBefore( $date, $progressCallback = false ) { // stub diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 761149dd6a..559dc9e08f 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -4660,7 +4660,7 @@ class Parser { * Please read the documentation in includes/parser/Preprocessor.php for more information * about the methods available in PPFrame and PPNode. * - * @return The old callback function for this name, if any + * @return string|callback The old callback function for this name, if any */ public function setFunctionHook( $id, $callback, $flags = 0 ) { global $wgContLang; @@ -4891,7 +4891,7 @@ class Parser { * * @param $title Title * @param $options String - * @param $holders LinkHolderArray|false + * @param $holders LinkHolderArray|bool * @return string HTML */ function makeImage( $title, $options, $holders = false ) { diff --git a/includes/parser/ParserCache.php b/includes/parser/ParserCache.php index 8b0432904e..64a1aa0f8e 100644 --- a/includes/parser/ParserCache.php +++ b/includes/parser/ParserCache.php @@ -88,7 +88,7 @@ class ParserCache { * Retrieve the ParserOutput from ParserCache, even if it's outdated. * @param $article Article * @param $popts ParserOptions - * @return ParserOutput|false + * @return ParserOutput|bool */ public function getDirty( $article, $popts ) { $value = $this->get( $article, $popts, true ); @@ -143,7 +143,7 @@ class ParserCache { * @param $popts ParserOptions * @param $useOutdated * - * @return ParserOutput|false + * @return ParserOutput|bool */ public function get( $article, $popts, $useOutdated = false ) { global $wgCacheEpoch; diff --git a/includes/revisiondelete/RevisionDeleteAbstracts.php b/includes/revisiondelete/RevisionDeleteAbstracts.php index dc7af19440..ea3acdd28e 100644 --- a/includes/revisiondelete/RevisionDeleteAbstracts.php +++ b/includes/revisiondelete/RevisionDeleteAbstracts.php @@ -25,7 +25,7 @@ abstract class RevDel_List extends RevisionListBase { * Set the visibility for the revisions in this list. Logging and * transactions are done here. * - * @param $params Associative array of parameters. Members are: + * @param $params array Associative array of parameters. Members are: * value: The integer value to set the visibility to * comment: The log comment. * @return Status @@ -154,7 +154,7 @@ abstract class RevDel_List extends RevisionListBase { /** * Record a log entry on the action - * @param $params Associative array of parameters: + * @param $params array Associative array of parameters: * newBits: The new value of the *_deleted bitfield * oldBits: The old value of the *_deleted bitfield. * title: The target title diff --git a/includes/revisiondelete/RevisionDeleteUser.php b/includes/revisiondelete/RevisionDeleteUser.php index c88b4d9156..fe424efa30 100644 --- a/includes/revisiondelete/RevisionDeleteUser.php +++ b/includes/revisiondelete/RevisionDeleteUser.php @@ -30,7 +30,7 @@ class RevisionDeleteUser { * @param $name String username * @param $userId Int user id * @param $op String operator '|' or '&' - * @param $dbw null|Database, if you happen to have one lying around + * @param $dbw null|DatabaseBase, if you happen to have one lying around * @return bool */ private static function setUsernameBitfields( $name, $userId, $op, $dbw ) { @@ -127,4 +127,4 @@ class RevisionDeleteUser { public static function unsuppressUserName( $name, $userId, $dbw = null ) { return self::setUsernameBitfields( $name, $userId, '&', $dbw ); } -} \ No newline at end of file +} diff --git a/includes/specials/SpecialDeadendpages.php b/includes/specials/SpecialDeadendpages.php index 1266a0ce58..75818c9128 100644 --- a/includes/specials/SpecialDeadendpages.php +++ b/includes/specials/SpecialDeadendpages.php @@ -39,7 +39,7 @@ class DeadendPagesPage extends PageQueryPage { /** * LEFT JOIN is expensive * - * @return true + * @return bool */ function isExpensive() { return true; @@ -50,7 +50,7 @@ class DeadendPagesPage extends PageQueryPage { } /** - * @return false + * @return bool */ function sortDescending() { return false; -- 2.20.1