From 2ec09c5165ecec660dc62d947864b8933dc3224a Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Thu, 9 Feb 2012 21:35:05 +0000 Subject: [PATCH] More return documentation --- includes/Init.php | 1 + includes/Linker.php | 20 +++++++++++++++++++ includes/LocalisationCache.php | 1 + includes/MimeMagic.php | 3 +++ includes/Namespace.php | 1 + includes/OutputPage.php | 1 + includes/PoolCounter.php | 1 + includes/installer/DatabaseInstaller.php | 9 +++++++++ includes/installer/Installer.php | 13 ++++++++++++ includes/installer/OracleInstaller.php | 1 + includes/installer/PostgresInstaller.php | 1 + includes/installer/PostgresUpdater.php | 1 + includes/installer/WebInstaller.php | 1 + includes/installer/WebInstallerPage.php | 1 + includes/json/Services_JSON.php | 1 + includes/logging/LogEntry.php | 1 + includes/logging/LogFormatter.php | 1 + includes/logging/LogPager.php | 2 ++ includes/media/Bitmap.php | 4 ++++ includes/media/DjVu.php | 1 + includes/media/DjVuImage.php | 1 + includes/media/Exif.php | 1 + includes/media/Generic.php | 12 +++++++++++ includes/media/MediaTransformOutput.php | 1 + includes/media/SVGMetadataExtractor.php | 1 + includes/normal/UtfNormal.php | 1 + includes/normal/UtfNormalTest.php | 1 + includes/normal/UtfNormalTest2.php | 1 + includes/objectcache/BagOStuff.php | 1 + includes/objectcache/MemcachedClient.php | 2 ++ .../objectcache/MemcachedPhpBagOStuff.php | 1 + includes/objectcache/MultiWriteBagOStuff.php | 1 + includes/objectcache/SqlBagOStuff.php | 3 +++ includes/parser/CoreParserFunctions.php | 10 +++++++++- includes/parser/DateFormatter.php | 4 ++++ includes/parser/LinkHolderArray.php | 6 +++++- includes/parser/Parser.php | 4 ++++ includes/parser/ParserCache.php | 2 ++ includes/parser/ParserOptions.php | 1 + includes/parser/ParserOutput.php | 2 ++ includes/parser/Preprocessor_DOM.php | 2 ++ includes/profiler/Profiler.php | 4 ++++ 42 files changed, 125 insertions(+), 2 deletions(-) diff --git a/includes/Init.php b/includes/Init.php index 72c10543af..5bfd3f5c4b 100644 --- a/includes/Init.php +++ b/includes/Init.php @@ -197,6 +197,7 @@ class MWInit { * @param $methodName string * @param $args array * + * @return mixed */ static function callStaticMethod( $className, $methodName, $args ) { $r = new ReflectionMethod( $className, $methodName ); diff --git a/includes/Linker.php b/includes/Linker.php index 6c00903148..4d4941165c 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -20,6 +20,7 @@ class Linker { * * @param $class String: the contents of the class attribute; if an empty * string is passed, which is the default value, defaults to 'external'. + * @return string * @deprecated since 1.18 Just pass the external class directly to something using Html::expandAttributes */ static function getExternalLinkAttributes( $class = 'external' ) { @@ -36,6 +37,7 @@ class Linker { * @param $unused String: unused * @param $class String: the contents of the class attribute; if an empty * string is passed, which is the default value, defaults to 'external'. + * @return string */ static function getInterwikiLinkAttributes( $title, $unused = null, $class = 'external' ) { global $wgContLang; @@ -57,6 +59,7 @@ class Linker { * not HTML-escaped * @param $unused String: unused * @param $class String: the contents of the class attribute, default none + * @return string */ static function getInternalLinkAttributes( $title, $unused = null, $class = '' ) { $title = urldecode( $title ); @@ -73,6 +76,7 @@ class Linker { * @param $class String: the contents of the class attribute, default none * @param $title Mixed: optional (unescaped) string to use in the title * attribute; if false, default to the name of the page we're linking to + * @return string */ static function getInternalLinkAttributesObj( $nt, $unused = null, $class = '', $title = false ) { if ( $title === false ) { @@ -229,6 +233,7 @@ class Linker { /** * Identical to link(), except $options defaults to 'known'. + * @return string */ public static function linkKnown( $target, $html = null, $customAttribs = array(), @@ -243,6 +248,7 @@ class Linker { * @param $target Title * @param $query Array: query parameters * @param $options Array + * @return String */ private static function linkUrl( $target, $query, $options ) { wfProfileIn( __METHOD__ ); @@ -641,6 +647,7 @@ class Linker { * @param $params Array * @param $framed Boolean * @param $manualthumb String + * @return mixed */ public static function makeThumbLinkObj( Title $title, $file, $label = '', $alt, $align = 'right', $params = array(), $framed = false , $manualthumb = "" ) @@ -893,6 +900,7 @@ class Linker { * @param $escape Boolean: do we escape the link text? * @param $linktype String: type of external link. Gets added to the classes * @param $attribs Array of extra attributes to + * @return string */ public static function makeExternalLink( $url, $text, $escape = true, $linktype = '', $attribs = array() ) { $class = "external"; @@ -998,6 +1006,7 @@ class Linker { * @param $userId Integer: user identifier * @param $userText String: user name or IP address * @param $edits Integer: user edit count (optional, for performance) + * @return String */ public static function userToolLinksRedContribs( $userId, $userText, $edits = null ) { return self::userToolLinks( $userId, $userText, true, 0, $edits ); @@ -1096,6 +1105,7 @@ class Linker { * @param $comment String * @param $title Mixed: Title object (to generate link to the section in autocomment) or null * @param $local Boolean: whether section links should refer to local page + * @return mixed|String */ public static function formatComment( $comment, $title = null, $local = false ) { wfProfileIn( __METHOD__ ); @@ -1474,6 +1484,7 @@ class Linker { * End a Table Of Contents line. * tocUnindent() will be used instead if we're ending a line below * the new level. + * @return string */ public static function tocLineEnd() { return "\n"; @@ -1552,6 +1563,7 @@ class Linker { /** * Split a link trail, return the "inside" portion and the remainder of the trail * as a two-element array + * @return array */ static function splitTrail( $trail ) { global $wgContLang; @@ -1579,6 +1591,7 @@ class Linker { * other users. * * @param $rev Revision object + * @return string */ public static function generateRollback( $rev ) { return '[' @@ -1886,6 +1899,7 @@ class Linker { * @param $trail String: Optional trail. Alphabetic characters at the start of this string will * be included in the link text. Other characters will be appended after * the end of the link. + * @return string */ static function makeBrokenLink( $title, $text = '', $query = '', $trail = '' ) { wfDeprecated( __METHOD__, '1.16' ); @@ -1914,6 +1928,7 @@ class Linker { * be included in the link text. Other characters will be appended after * the end of the link. * @param $prefix String: optional prefix. As trail, only before instead of after. + * @return string */ static function makeLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' ) { # wfDeprecated( __METHOD__, '1.16' ); // See r105985 and it's revert. Somewhere still used. @@ -1983,6 +1998,7 @@ class Linker { * be included in the link text. Other characters will be appended after * the end of the link. * @param $prefix String: Optional prefix + * @return string */ static function makeBrokenLinkObj( $title, $text = '', $query = '', $trail = '', $prefix = '' ) { wfDeprecated( __METHOD__, '1.16' ); @@ -2014,6 +2030,7 @@ class Linker { * be included in the link text. Other characters will be appended after * the end of the link. * @param $prefix String: Optional prefix + * @return string */ static function makeColouredLinkObj( $nt, $colour, $text = '', $query = '', $trail = '', $prefix = '' ) { wfDeprecated( __METHOD__, '1.16' ); @@ -2028,6 +2045,7 @@ class Linker { /** * Returns the attributes for the tooltip and access key. + * @return array */ public static function tooltipAndAccesskeyAttribs( $name ) { # @todo FIXME: If Sanitizer::expandAttributes() treated "false" as "output @@ -2048,6 +2066,7 @@ class Linker { /** * Returns raw bits of HTML, use titleAttrib() + * @return null|string */ public static function tooltip( $name, $options = null ) { # @todo FIXME: If Sanitizer::expandAttributes() treated "false" as "output @@ -2074,6 +2093,7 @@ class DummyLinker { * * @param $fname String Name of called method * @param $args Array Arguments to the method + * @return mixed */ public function __call( $fname, $args ) { return call_user_func_array( array( 'Linker', $fname ), $args ); diff --git a/includes/LocalisationCache.php b/includes/LocalisationCache.php index 7e3a09ce53..f62adc750d 100644 --- a/includes/LocalisationCache.php +++ b/includes/LocalisationCache.php @@ -343,6 +343,7 @@ class LocalisationCache { /** * Returns true if the cache identified by $code is missing or expired. + * @return bool */ public function isExpired( $code ) { if ( $this->forceRecache && !isset( $this->recachedLangs[$code] ) ) { diff --git a/includes/MimeMagic.php b/includes/MimeMagic.php index f86b6051cc..b91af6169f 100644 --- a/includes/MimeMagic.php +++ b/includes/MimeMagic.php @@ -566,6 +566,7 @@ class MimeMagic { * * @param string $file * @param mixed $ext + * @return bool|string */ private function doGuessMimeType( $file, $ext ) { // TODO: remove $ext param // Read a chunk of the file @@ -1030,6 +1031,7 @@ class MimeMagic { * * This funktion relies on the mapping defined by $this->mMediaTypes * @access private + * @return int|string */ function findMediaType( $extMime ) { if ( strpos( $extMime, '.' ) === 0 ) { @@ -1067,6 +1069,7 @@ class MimeMagic { * @param $fileName String: the file name (unused at present) * @param $chunk String: the first 256 bytes of the file * @param $proposed String: the MIME type proposed by the server + * @return Array */ public function getIEMimeTypes( $fileName, $chunk, $proposed ) { $ca = $this->getIEContentAnalyzer(); diff --git a/includes/Namespace.php b/includes/Namespace.php index e536d8b0f1..6ff6f0b916 100644 --- a/includes/Namespace.php +++ b/includes/Namespace.php @@ -67,6 +67,7 @@ class MWNamespace { /** * @see self::isSubject * @deprecated Please use the more consistently named isSubject (since 1.19) + * @return bool */ public static function isMain( $index ) { wfDeprecated( __METHOD__, '1.19' ); diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 2cc6f4cbf5..ae55d3fb30 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -2788,6 +2788,7 @@ $templates /** * JS stuff to put at the bottom of the + * @return string */ function getBottomScripts() { global $wgResourceLoaderExperimentalAsyncLoading; diff --git a/includes/PoolCounter.php b/includes/PoolCounter.php index 83ae0abea0..4edcb060ee 100644 --- a/includes/PoolCounter.php +++ b/includes/PoolCounter.php @@ -150,6 +150,7 @@ abstract class PoolCounterWork { /** * Do something with the error, like showing it to the user. + * @return bool */ function error( $status ) { return false; diff --git a/includes/installer/DatabaseInstaller.php b/includes/installer/DatabaseInstaller.php index 33327ef7a2..8cbc8c686f 100644 --- a/includes/installer/DatabaseInstaller.php +++ b/includes/installer/DatabaseInstaller.php @@ -88,6 +88,7 @@ abstract class DatabaseInstaller { * $this->parent can be assumed to be a WebInstaller. * If the DB type has no settings beyond those already configured with * getConnectForm(), this should return false. + * @return bool */ public function getSettingsForm() { return false; @@ -207,6 +208,7 @@ abstract class DatabaseInstaller { /** * Override this to provide DBMS-specific schema variables, to be * substituted into tables.sql and other schema files. + * @return array */ public function getSchemaVars() { return array(); @@ -282,6 +284,7 @@ abstract class DatabaseInstaller { /** * Get an array of MW configuration globals that will be configured by this class. + * @return array */ public function getGlobalNames() { return $this->globalNames; @@ -313,6 +316,7 @@ abstract class DatabaseInstaller { /** * Get the internationalised name for this DBMS. + * @return String */ public function getReadableName() { return wfMsg( 'config-type-' . $this->getName() ); @@ -321,6 +325,7 @@ abstract class DatabaseInstaller { /** * Get a name=>value map of MW configuration globals that overrides. * DefaultSettings.php + * @return array */ public function getGlobalDefaults() { return array(); @@ -328,6 +333,7 @@ abstract class DatabaseInstaller { /** * Get a name=>value map of internal variables used during installation. + * @return array */ public function getInternalDefaults() { return $this->internalDefaults; @@ -439,6 +445,7 @@ abstract class DatabaseInstaller { * values: List of allowed values (required) * itemAttribs Array of attribute arrays, outer key is the value name (optional) * + * @return string */ public function getRadioSet( $params ) { $params['controlName'] = $this->getName() . '_' . $params['var']; @@ -451,6 +458,7 @@ abstract class DatabaseInstaller { * Assumes that variables containing "password" in the name are (potentially * fake) passwords. * @param $varNames Array + * @return array */ public function setVarsFromRequest( $varNames ) { return $this->parent->setVarsFromRequest( $varNames, $this->getName() . '_' ); @@ -494,6 +502,7 @@ abstract class DatabaseInstaller { /** * Submit a standard install user fieldset. + * @return Status */ public function submitInstallUserBox() { $this->setVarsFromRequest( array( '_InstallUser', '_InstallPassword' ) ); diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php index 5580f1752d..0b6dc1395c 100644 --- a/includes/installer/Installer.php +++ b/includes/installer/Installer.php @@ -672,6 +672,7 @@ abstract class Installer { /** * Some versions of libxml+PHP break < and > encoding horribly + * @return bool */ protected function envCheckBrokenXML() { $test = new PhpXmlBugTester(); @@ -684,6 +685,7 @@ abstract class Installer { /** * Test PHP (probably 5.3.1, but it could regress again) to make sure that * reference parameters to __call() are not converted to null + * @return bool */ protected function envCheckPHP531() { $test = new PhpRefCallBugTester; @@ -696,6 +698,7 @@ abstract class Installer { /** * Environment check for magic_quotes_runtime. + * @return bool */ protected function envCheckMagicQuotes() { if( wfIniGetBool( "magic_quotes_runtime" ) ) { @@ -706,6 +709,7 @@ abstract class Installer { /** * Environment check for magic_quotes_sybase. + * @return bool */ protected function envCheckMagicSybase() { if ( wfIniGetBool( 'magic_quotes_sybase' ) ) { @@ -716,6 +720,7 @@ abstract class Installer { /** * Environment check for mbstring.func_overload. + * @return bool */ protected function envCheckMbstring() { if ( wfIniGetBool( 'mbstring.func_overload' ) ) { @@ -726,6 +731,7 @@ abstract class Installer { /** * Environment check for zend.ze1_compatibility_mode. + * @return bool */ protected function envCheckZE1() { if ( wfIniGetBool( 'zend.ze1_compatibility_mode' ) ) { @@ -746,6 +752,7 @@ abstract class Installer { /** * Environment check for the XML module. + * @return bool */ protected function envCheckXML() { if ( !function_exists( "utf8_encode" ) ) { @@ -756,6 +763,7 @@ abstract class Installer { /** * Environment check for the PCRE module. + * @return bool */ protected function envCheckPCRE() { if ( !function_exists( 'preg_match' ) ) { @@ -773,6 +781,7 @@ abstract class Installer { /** * Environment check for available memory. + * @return bool */ protected function envCheckMemory() { $limit = ini_get( 'memory_limit' ); @@ -846,6 +855,7 @@ abstract class Installer { /** * Environment check for ImageMagick and GD. + * @return bool */ protected function envCheckGraphics() { $names = array( wfIsWindows() ? 'convert.exe' : 'convert' ); @@ -981,6 +991,7 @@ abstract class Installer { /** * TODO: document + * @return bool */ protected function envCheckUploadsDirectory() { global $IP; @@ -1121,6 +1132,7 @@ abstract class Installer { * * If $versionInfo is not false, only executables with a version * matching $versionInfo[1] will be returned. + * @return bool|string */ public static function locateExecutable( $path, $names, $versionInfo = false ) { if ( !is_array( $names ) ) { @@ -1169,6 +1181,7 @@ abstract class Installer { * Checks if scripts located in the given directory can be executed via the given URL. * * Used only by environment checks. + * @return bool|int|string */ public function dirIsExecutable( $dir, $url ) { $scriptTypes = array( diff --git a/includes/installer/OracleInstaller.php b/includes/installer/OracleInstaller.php index 7f04f75ec8..b457033b7b 100644 --- a/includes/installer/OracleInstaller.php +++ b/includes/installer/OracleInstaller.php @@ -241,6 +241,7 @@ class OracleInstaller extends DatabaseInstaller { /** * Overload: after this action field info table has to be rebuilt + * @return Status */ public function createTables() { $this->setupSchemaVars(); diff --git a/includes/installer/PostgresInstaller.php b/includes/installer/PostgresInstaller.php index eb9ba2893c..fa5a62888f 100644 --- a/includes/installer/PostgresInstaller.php +++ b/includes/installer/PostgresInstaller.php @@ -344,6 +344,7 @@ class PostgresInstaller extends DatabaseInstaller { /** * Returns true if the install user is able to create objects owned * by the web user, false otherwise. + * @return bool */ protected function canCreateObjectsForWebUser() { if ( $this->isSuperUser() ) { diff --git a/includes/installer/PostgresUpdater.php b/includes/installer/PostgresUpdater.php index 41e5b31378..9f4b760ec5 100644 --- a/includes/installer/PostgresUpdater.php +++ b/includes/installer/PostgresUpdater.php @@ -23,6 +23,7 @@ class PostgresUpdater extends DatabaseUpdater { /** * @todo FIXME: Postgres should use sequential updates like Mysql, Sqlite * and everybody else. It never got refactored like it should've. + * @return array */ protected function getCoreUpdateList() { return array( diff --git a/includes/installer/WebInstaller.php b/includes/installer/WebInstaller.php index 1ff77db7a7..c340d9a392 100644 --- a/includes/installer/WebInstaller.php +++ b/includes/installer/WebInstaller.php @@ -433,6 +433,7 @@ class WebInstaller extends Installer { * * @param $name String * @param $default + * @return null */ public function getSession( $name, $default = null ) { if ( !isset( $this->session[$name] ) ) { diff --git a/includes/installer/WebInstallerPage.php b/includes/installer/WebInstallerPage.php index 85ec880d0d..9f5b0e4ef1 100644 --- a/includes/installer/WebInstallerPage.php +++ b/includes/installer/WebInstallerPage.php @@ -36,6 +36,7 @@ abstract class WebInstallerPage { * Is this a slow-running page in the installer? If so, WebInstaller will * set_time_limit(0) before calling execute(). Right now this only applies * to Install and Upgrade pages + * @return bool */ public function isSlow() { return false; diff --git a/includes/json/Services_JSON.php b/includes/json/Services_JSON.php index b2090dce7b..398ed6a28f 100644 --- a/includes/json/Services_JSON.php +++ b/includes/json/Services_JSON.php @@ -826,6 +826,7 @@ class Services_JSON /** * @todo Ultimately, this should just call PEAR::isError() + * @return bool */ function isError($data, $code = null) { diff --git a/includes/logging/LogEntry.php b/includes/logging/LogEntry.php index b28a24d415..66f0611cb4 100644 --- a/includes/logging/LogEntry.php +++ b/includes/logging/LogEntry.php @@ -97,6 +97,7 @@ abstract class LogEntryBase implements LogEntry { /** * Whether the parameters for this log are stored in new or * old format. + * @return bool */ public function isLegacy() { return false; diff --git a/includes/logging/LogFormatter.php b/includes/logging/LogFormatter.php index 945660c31c..6c454b3c95 100644 --- a/includes/logging/LogFormatter.php +++ b/includes/logging/LogFormatter.php @@ -272,6 +272,7 @@ class LogFormatter { * Provides the name of the user who performed the log action. * Used as part of log action message or standalone, depending * which parts of the log entry has been hidden. + * @return String */ public function getPerformerElement() { if ( $this->canView( LogPage::DELETED_USER ) ) { diff --git a/includes/logging/LogPager.php b/includes/logging/LogPager.php index 16781a6ef8..ea1be8e0d3 100644 --- a/includes/logging/LogPager.php +++ b/includes/logging/LogPager.php @@ -131,6 +131,7 @@ class LogPager extends ReverseChronologicalPager { * Set the log reader to return only entries by the given user. * * @param $name String: (In)valid user name + * @return bool */ private function limitPerformer( $name ) { if( $name == '' ) { @@ -166,6 +167,7 @@ class LogPager extends ReverseChronologicalPager { * * @param $page String or Title object: Title name * @param $pattern String + * @return bool */ private function limitTitle( $page, $pattern ) { global $wgMiserMode; diff --git a/includes/media/Bitmap.php b/includes/media/Bitmap.php index 619485ccf2..3e039ffa4d 100644 --- a/includes/media/Bitmap.php +++ b/includes/media/Bitmap.php @@ -572,6 +572,7 @@ class BitmapHandler extends ImageHandler { /** * Escape a string for ImageMagick's property input (e.g. -set -comment) * See InterpretImageProperties() in magick/property.c + * @return mixed|string */ function escapeMagickProperty( $s ) { // Double the backslashes @@ -599,6 +600,7 @@ class BitmapHandler extends ImageHandler { * * @param $path string The file path * @param $scene string The scene specification, or false if there is none + * @return string */ function escapeMagickInput( $path, $scene = false ) { # Die on initial metacharacters (caller should prepend path) @@ -616,6 +618,7 @@ class BitmapHandler extends ImageHandler { /** * Escape a string for ImageMagick's output filename. See * InterpretImageFilename() in magick/image.c. + * @return string */ function escapeMagickOutput( $path, $scene = false ) { $path = str_replace( '%', '%%', $path ); @@ -628,6 +631,7 @@ class BitmapHandler extends ImageHandler { * * @param $path string The file path * @param $scene string The scene specification, or false if there is none + * @return string */ protected function escapeMagickPath( $path, $scene = false ) { # Die on format specifiers (other than drive letters). The regex is diff --git a/includes/media/DjVu.php b/includes/media/DjVu.php index dedbee0d04..2f960d9b5f 100644 --- a/includes/media/DjVu.php +++ b/includes/media/DjVu.php @@ -191,6 +191,7 @@ class DjVuHandler extends ImageHandler { * Cache a document tree for the DjVu XML metadata * @param $image File * @param $gettext Boolean: DOCUMENT (Default: false) + * @return bool */ function getMetaTree( $image , $gettext = false ) { if ( isset( $image->dejaMetaTree ) ) { diff --git a/includes/media/DjVuImage.php b/includes/media/DjVuImage.php index 80b7408cbe..25aacdcbe7 100644 --- a/includes/media/DjVuImage.php +++ b/includes/media/DjVuImage.php @@ -284,6 +284,7 @@ EOR; /** * Hack to temporarily work around djvutoxml bug + * @return bool|string */ function convertDumpToXML( $dump ) { if ( strval( $dump ) == '' ) { diff --git a/includes/media/Exif.php b/includes/media/Exif.php index a4acdfe02d..4fb13c6559 100644 --- a/includes/media/Exif.php +++ b/includes/media/Exif.php @@ -549,6 +549,7 @@ class Exif { */ /** * Get $this->mRawExifData + * @return array */ function getData() { return $this->mRawExifData; diff --git a/includes/media/Generic.php b/includes/media/Generic.php index b118309651..af1ca4d66a 100644 --- a/includes/media/Generic.php +++ b/includes/media/Generic.php @@ -160,6 +160,7 @@ abstract class MediaHandler { * MediaHandler::METADATA_GOOD for if the metadata is a-ok, * MediaHanlder::METADATA_COMPATIBLE if metadata is old but backwards * compatible (which may or may not trigger a metadata reload). + * @return bool */ function isMetadataValid( $image, $metadata ) { return self::METADATA_GOOD; @@ -173,6 +174,7 @@ abstract class MediaHandler { * Used when the repository has a thumbnailScriptUrl option configured. * * Return false to fall back to the regular getTransform(). + * @return bool */ function getScriptedTransform( $image, $script, $params ) { return false; @@ -186,6 +188,7 @@ abstract class MediaHandler { * @param $dstPath String: filesystem destination path * @param $dstUrl String: Destination URL to use in output HTML * @param $params Array: Arbitrary set of parameters validated by $this->validateParam() + * @return \MediaTransformOutput */ final function getTransform( $image, $dstPath, $dstUrl, $params ) { return $this->doTransform( $image, $dstPath, $dstUrl, $params, self::TRANSFORM_LATER ); @@ -227,27 +230,33 @@ abstract class MediaHandler { /** * True if the handled types can be transformed + * @return bool */ function canRender( $file ) { return true; } /** * True if handled types cannot be displayed directly in a browser * but can be rendered + * @return bool */ function mustRender( $file ) { return false; } /** * True if the type has multi-page capabilities + * @return bool */ function isMultiPage( $file ) { return false; } /** * Page count for a multi-page document, false if unsupported or unknown + * @return bool */ function pageCount( $file ) { return false; } /** * The material is vectorized and thus scaling is lossless + * @return bool */ function isVectorized( $file ) { return false; } /** * False if the handler is disabled for all files + * @return bool */ function isEnabled() { return true; } @@ -258,6 +267,7 @@ abstract class MediaHandler { * Returns false if unknown or if the document is not multi-page. * * @param $image File + * @return array */ function getPageDimensions( $image, $page ) { $gis = $this->getImageSize( $image, $image->getLocalRefPath() ); @@ -270,6 +280,7 @@ abstract class MediaHandler { /** * Generic getter for text layer. * Currently overloaded by PDF and DjVu handlers + * @return bool */ function getPageText( $image, $page ) { return false; @@ -300,6 +311,7 @@ abstract class MediaHandler { * all the formatting according to some standard. That makes it possible * to do things like visual indication of grouped and chained streams * in ogg container files. + * @return bool */ function formatMetadata( $image ) { return false; diff --git a/includes/media/MediaTransformOutput.php b/includes/media/MediaTransformOutput.php index ed2ba8ca89..380731c46b 100644 --- a/includes/media/MediaTransformOutput.php +++ b/includes/media/MediaTransformOutput.php @@ -80,6 +80,7 @@ abstract class MediaTransformOutput { /** * This will be overridden to return true in error classes + * @return bool */ public function isError() { return false; diff --git a/includes/media/SVGMetadataExtractor.php b/includes/media/SVGMetadataExtractor.php index db9f05fd4b..26e42d1fc3 100644 --- a/includes/media/SVGMetadataExtractor.php +++ b/includes/media/SVGMetadataExtractor.php @@ -99,6 +99,7 @@ class SVGReader { /** * Read the SVG + * @return bool */ public function read() { $keepReading = $this->reader->read(); diff --git a/includes/normal/UtfNormal.php b/includes/normal/UtfNormal.php index b5aad301ce..2b400e5a85 100644 --- a/includes/normal/UtfNormal.php +++ b/includes/normal/UtfNormal.php @@ -238,6 +238,7 @@ class UtfNormal { * Returns true if the string is _definitely_ in NFC. * Returns false if not or uncertain. * @param $string String: a UTF-8 string, altered on output to be valid UTF-8 safe for XML. + * @return bool */ static function quickIsNFCVerify( &$string ) { # Screen out some characters that eg won't be allowed in XML diff --git a/includes/normal/UtfNormalTest.php b/includes/normal/UtfNormalTest.php index e5ae7f7246..5872ec34ca 100644 --- a/includes/normal/UtfNormalTest.php +++ b/includes/normal/UtfNormalTest.php @@ -37,6 +37,7 @@ if( defined( 'PRETTY_UTF8' ) ) { } else { /** * @ignore + * @return string */ function pretty( $string ) { return trim( preg_replace( '/(.)/use', diff --git a/includes/normal/UtfNormalTest2.php b/includes/normal/UtfNormalTest2.php index 28be483858..f478fa9190 100644 --- a/includes/normal/UtfNormalTest2.php +++ b/includes/normal/UtfNormalTest2.php @@ -61,6 +61,7 @@ function normalize_form_kd($c) { return UtfNormal::toNFKD($c); } * following functions to force pure PHP usage. I decided not to * commit that code since might produce a slowdown in the UTF * normalization code just for the sake of these tests. -- hexmode + * @return string */ function normalize_form_c_php($c) { return UtfNormal::toNFC($c, "php"); } function normalize_form_d_php($c) { return UtfNormal::toNFD($c, "php"); } diff --git a/includes/objectcache/BagOStuff.php b/includes/objectcache/BagOStuff.php index 52387f76a5..a4545ef83b 100644 --- a/includes/objectcache/BagOStuff.php +++ b/includes/objectcache/BagOStuff.php @@ -155,6 +155,7 @@ abstract class BagOStuff { /** * Convert an optionally relative time to an absolute time + * @return int */ protected function convertExpiry( $exptime ) { if ( ( $exptime != 0 ) && ( $exptime < 86400 * 3650 /* 10 years */ ) ) { diff --git a/includes/objectcache/MemcachedClient.php b/includes/objectcache/MemcachedClient.php index 868ad69fe2..f8208f61da 100644 --- a/includes/objectcache/MemcachedClient.php +++ b/includes/objectcache/MemcachedClient.php @@ -871,6 +871,7 @@ class MWMemcached { * @param $sock Resource: socket to read from * @param $ret Array: returned values * + * @return bool|int * @access private */ function _load_items( $sock, &$ret ) { @@ -1079,6 +1080,7 @@ class MWMemcached { /** * Original behaviour + * @return int */ function _safe_fwrite( $f, $buf, $len = false ) { if ( $len === false ) { diff --git a/includes/objectcache/MemcachedPhpBagOStuff.php b/includes/objectcache/MemcachedPhpBagOStuff.php index 1401668399..021dfb723e 100644 --- a/includes/objectcache/MemcachedPhpBagOStuff.php +++ b/includes/objectcache/MemcachedPhpBagOStuff.php @@ -153,6 +153,7 @@ class MemcachedPhpBagOStuff extends BagOStuff { * the other control characters for compatibility with libmemcached * verify_key. We leave other punctuation alone, to maximise backwards * compatibility. + * @return string */ public function encodeKey( $key ) { return preg_replace_callback( '/[\x00-\x20\x25\x7f]+/', diff --git a/includes/objectcache/MultiWriteBagOStuff.php b/includes/objectcache/MultiWriteBagOStuff.php index 0d95a846d6..9063093a13 100644 --- a/includes/objectcache/MultiWriteBagOStuff.php +++ b/includes/objectcache/MultiWriteBagOStuff.php @@ -100,6 +100,7 @@ class MultiWriteBagOStuff extends BagOStuff { * Delete objects expiring before a certain date. * * Succeed if any of the child caches succeed. + * @return bool */ public function deleteObjectsExpiringBefore( $date, $progressCallback = false ) { $ret = false; diff --git a/includes/objectcache/SqlBagOStuff.php b/includes/objectcache/SqlBagOStuff.php index 93d22f1129..617c093944 100644 --- a/includes/objectcache/SqlBagOStuff.php +++ b/includes/objectcache/SqlBagOStuff.php @@ -92,6 +92,7 @@ class SqlBagOStuff extends BagOStuff { /** * Get the table name for a given key + * @return string */ protected function getTableByKey( $key ) { if ( $this->shards > 1 ) { @@ -104,6 +105,7 @@ class SqlBagOStuff extends BagOStuff { /** * Get the table name for a given shard index + * @return string */ protected function getTableByShard( $index ) { if ( $this->shards > 1 ) { @@ -310,6 +312,7 @@ class SqlBagOStuff extends BagOStuff { /** * Delete objects from the database which expire before a certain date. + * @return bool */ public function deleteObjectsExpiringBefore( $timestamp, $progressCallback = false ) { $db = $this->getDB(); diff --git a/includes/parser/CoreParserFunctions.php b/includes/parser/CoreParserFunctions.php index f9ae237983..13aa66f1ed 100644 --- a/includes/parser/CoreParserFunctions.php +++ b/includes/parser/CoreParserFunctions.php @@ -154,6 +154,7 @@ class CoreParserFunctions { * @param $parser Parser object * @param $s String: The text to encode. * @param $arg String (optional): The type of encoding. + * @return string */ static function urlencode( $parser, $s = '', $arg = null ) { static $magicWords = null; @@ -418,6 +419,7 @@ class CoreParserFunctions { * corresponding magic word * Note: function name changed to "mwnamespace" rather than "namespace" * to not break PHP 5.3 + * @return mixed|string */ static function mwnamespace( $parser, $title = null ) { $t = Title::newFromText( $title ); @@ -459,6 +461,7 @@ class CoreParserFunctions { /** * Functions to get and normalize pagenames, corresponding to the magic words * of the same names + * @return String */ static function pagename( $parser, $title = null ) { $t = Title::newFromText( $title ); @@ -537,6 +540,7 @@ class CoreParserFunctions { * Return the number of pages in the given category, or 0 if it's nonexis- * tent. This is an expensive parser function and can't be called too many * times per page. + * @return string */ static function pagesincategory( $parser, $name = '', $raw = null ) { static $cache = array(); @@ -574,6 +578,7 @@ class CoreParserFunctions { * @param $parser Parser * @param $page String TODO DOCUMENT (Default: empty string) * @param $raw TODO DOCUMENT (Default: null) + * @return string */ static function pagesize( $parser, $page = '', $raw = null ) { static $cache = array(); @@ -603,7 +608,8 @@ class CoreParserFunctions { /** * Returns the requested protection level for the current page - */ + * @return string + */ static function protectionlevel( $parser, $type = '' ) { $restrictions = $parser->mTitle->getRestrictions( strtolower( $type ) ); # Title::getRestrictions returns an array, its possible it may have @@ -634,6 +640,7 @@ class CoreParserFunctions { /** * Unicode-safe str_pad with the restriction that $length is forced to be <= 500 + * @return string */ static function pad( $string, $length, $padding = '0', $direction = STR_PAD_RIGHT ) { $lengthOfPadding = mb_strlen( $padding ); @@ -764,6 +771,7 @@ class CoreParserFunctions { /** * Parser function to extension tag adaptor + * @return string */ public static function tagObj( $parser, $frame, $args ) { if ( !count( $args ) ) { diff --git a/includes/parser/DateFormatter.php b/includes/parser/DateFormatter.php index 6559e88660..2199004a77 100644 --- a/includes/parser/DateFormatter.php +++ b/includes/parser/DateFormatter.php @@ -122,6 +122,7 @@ class DateFormatter * @param $preference String: User preference * @param $text String: Text to reformat * @param $options Array: can contain 'linked' and/or 'match-whole' + * @return mixed|String */ function reformat( $preference, $text, $options = array('linked') ) { @@ -172,6 +173,7 @@ class DateFormatter /** * @param $matches + * @return string */ function replace( $matches ) { # Extract information from $matches @@ -282,6 +284,7 @@ class DateFormatter /** * @todo document + * @return string */ function getMonthRegex() { global $wgContLang; @@ -325,6 +328,7 @@ class DateFormatter /** * @todo document + * @return int|string */ function makeNormalYear( $iso ) { if ( $iso[0] == '-' ) { diff --git a/includes/parser/LinkHolderArray.php b/includes/parser/LinkHolderArray.php index fb01304734..69fd206f2a 100644 --- a/includes/parser/LinkHolderArray.php +++ b/includes/parser/LinkHolderArray.php @@ -33,7 +33,8 @@ class LinkHolderArray { * serializing at present. * * Compact the titles, only serialize the text form. - */ + * @return array + */ function __sleep() { foreach ( $this->internals as &$nsLinks ) { foreach ( $nsLinks as &$entry ) { @@ -134,6 +135,7 @@ class LinkHolderArray { /** * Get a subset of the current LinkHolderArray which is sufficient to * interpret the given text. + * @return \LinkHolderArray */ function getSubArray( $text ) { $sub = new LinkHolderArray( $this->parent ); @@ -167,6 +169,7 @@ class LinkHolderArray { /** * Returns true if the memory requirements of this object are getting large + * @return bool */ function isBig() { global $wgLinkHolderBatchSize; @@ -190,6 +193,7 @@ class LinkHolderArray { * article length checks (for stub links) to be bundled into a single query. * * @param $nt Title + * @return string */ function makeHolder( $nt, $text = '', $query = array(), $trail = '', $prefix = '' ) { wfProfileIn( __METHOD__ ); diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 0b18c5a592..d308456599 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -494,6 +494,7 @@ class Parser { /** * Expand templates and variables in the text, producing valid, static wikitext. * Also removes comments. + * @return mixed|string */ function preprocess( $text, Title $title, ParserOptions $options, $revid = null ) { wfProfileIn( __METHOD__ ); @@ -840,6 +841,7 @@ class Parser { * parse the wiki syntax used to render tables * * @private + * @return string */ function doTableStuff( $text ) { wfProfileIn( __METHOD__ ); @@ -3892,6 +3894,7 @@ class Parser { * @param $text String * @param $origText String: original, untouched wikitext * @param $isMain Boolean + * @return mixed|string * @private */ function formatHeadings( $text, $origText, $isMain=true ) { @@ -4711,6 +4714,7 @@ class Parser { * Create a tag function, e.g. some stuff. * Unlike tag hooks, tag functions are parsed at preprocessor level. * Unlike parser functions, their content is not preprocessed. + * @return null */ function setFunctionTagHook( $tag, $callback, $flags ) { $tag = strtolower( $tag ); diff --git a/includes/parser/ParserCache.php b/includes/parser/ParserCache.php index 64a1aa0f8e..bde310ef78 100644 --- a/includes/parser/ParserCache.php +++ b/includes/parser/ParserCache.php @@ -77,6 +77,7 @@ class ParserCache { * * @param $article Article * @param $popts ParserOptions + * @return string */ function getETag( $article, $popts ) { return 'W/"' . $this->getParserOutputKey( $article, @@ -104,6 +105,7 @@ class ParserCache { * * @param $article Article * @param $popts ParserOptions + * @return bool|mixed|string */ public function getKey( $article, $popts, $useOutdated = true ) { global $wgCacheEpoch; diff --git a/includes/parser/ParserOptions.php b/includes/parser/ParserOptions.php index 57d3a7eb37..bf9611f365 100644 --- a/includes/parser/ParserOptions.php +++ b/includes/parser/ParserOptions.php @@ -428,6 +428,7 @@ class ParserOptions { * Returns the full array of options that would have been used by * in 1.16. * Used to get the old parser cache entries when available. + * @return array */ public static function legacyOptions() { global $wgUseDynamicDates; diff --git a/includes/parser/ParserOutput.php b/includes/parser/ParserOutput.php index 2d99a3b5c7..0d597e8592 100644 --- a/includes/parser/ParserOutput.php +++ b/includes/parser/ParserOutput.php @@ -60,6 +60,7 @@ class CacheTime { * The value returned by getCacheExpiry is smaller or equal to the smallest number * that was provided to a call of updateCacheExpiry(), and smaller or equal to the * value of $wgParserCacheExpireTime. + * @return int|mixed|null */ function getCacheExpiry() { global $wgParserCacheExpireTime; @@ -166,6 +167,7 @@ class ParserOutput extends CacheTime { /** * callback used by getText to replace editsection tokens * @private + * @return mixed */ function replaceEditSectionLinksCallback( $m ) { global $wgOut, $wgLang; diff --git a/includes/parser/Preprocessor_DOM.php b/includes/parser/Preprocessor_DOM.php index 066589f685..54079acfe4 100644 --- a/includes/parser/Preprocessor_DOM.php +++ b/includes/parser/Preprocessor_DOM.php @@ -1250,6 +1250,7 @@ class PPFrame_DOM implements PPFrame { /** * Virtual implode with brackets + * @return array */ function virtualBracketedImplode( $start, $sep, $end /*, ... */ ) { $args = array_slice( func_get_args(), 3 ); @@ -1674,6 +1675,7 @@ class PPNode_DOM implements PPNode { /** * Split a node + * @return array */ function splitHeading() { if ( $this->getName() !== 'h' ) { diff --git a/includes/profiler/Profiler.php b/includes/profiler/Profiler.php index 3d1a017a2d..b1ed9b680d 100644 --- a/includes/profiler/Profiler.php +++ b/includes/profiler/Profiler.php @@ -205,6 +205,7 @@ class Profiler { /** * Returns a tree of function call instead of a list of functions + * @return string */ function getCallTree() { return implode( '', array_map( array( &$this, 'getCallTreeLine' ), $this->remapCallTree( $this->mStack ) ) ); @@ -214,6 +215,7 @@ class Profiler { * Recursive function the format the current profiling array into a tree * * @param $stack array profiling array + * @return array */ function remapCallTree( $stack ) { if( count( $stack ) < 2 ){ @@ -252,6 +254,7 @@ class Profiler { /** * Callback to get a formatted line for the call tree + * @return string */ function getCallTreeLine( $entry ) { list( $fname, $level, $start, /* $x */, $end) = $entry; @@ -494,6 +497,7 @@ class Profiler { /** * Get the function name of the current profiling section + * @return */ function getCurrentSection() { $elt = end( $this->mWorkStack ); -- 2.20.1