r111052 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111051‎ | r111052 | r111053 >
Date:18:01, 9 February 2012
Author:reedy
Status:resolved
Tags:
Comment:
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
Modified paths:
  • /trunk/phase3/includes/HTMLForm.php (modified) (history)
  • /trunk/phase3/includes/HttpFunctions.php (modified) (history)
  • /trunk/phase3/includes/IP.php (modified) (history)
  • /trunk/phase3/includes/Linker.php (modified) (history)
  • /trunk/phase3/includes/MagicWord.php (modified) (history)
  • /trunk/phase3/includes/OutputPage.php (modified) (history)
  • /trunk/phase3/includes/Pager.php (modified) (history)
  • /trunk/phase3/includes/PathRouter.php (modified) (history)
  • /trunk/phase3/includes/Skin.php (modified) (history)
  • /trunk/phase3/includes/SkinTemplate.php (modified) (history)
  • /trunk/phase3/includes/SpecialPage.php (modified) (history)
  • /trunk/phase3/includes/Title.php (modified) (history)
  • /trunk/phase3/includes/User.php (modified) (history)
  • /trunk/phase3/includes/UserMailer.php (modified) (history)
  • /trunk/phase3/includes/WebRequest.php (modified) (history)
  • /trunk/phase3/includes/WikiPage.php (modified) (history)
  • /trunk/phase3/includes/Xml.php (modified) (history)
  • /trunk/phase3/includes/installer/PostgresInstaller.php (modified) (history)
  • /trunk/phase3/includes/logging/LogEntry.php (modified) (history)
  • /trunk/phase3/includes/logging/LogEventsList.php (modified) (history)
  • /trunk/phase3/includes/media/BitmapMetadataHandler.php (modified) (history)
  • /trunk/phase3/includes/media/GIFMetadataExtractor.php (modified) (history)
  • /trunk/phase3/includes/media/Generic.php (modified) (history)
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)
  • /trunk/phase3/includes/parser/Preprocessor_Hash.php (modified) (history)
  • /trunk/phase3/includes/revisiondelete/RevisionDeleteAbstracts.php (modified) (history)
  • /trunk/phase3/includes/revisiondelete/RevisionDeleter.php (modified) (history)
  • /trunk/phase3/includes/search/SearchEngine.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialDeletedContributions.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialMostlinkedtemplates.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialRecentchanges.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Xml.php
@@ -254,8 +254,8 @@
255255
256256 /**
257257 * Shortcut to make a specific element with a class attribute
258 - * @param $text content of the element, will be escaped
259 - * @param $class class name of the span element
 258+ * @param $text string content of the element, will be escaped
 259+ * @param $class string class name of the span element
260260 * @param $tag string element name
261261 * @param $attribs array other attributes
262262 * @return string
Index: trunk/phase3/includes/User.php
@@ -445,7 +445,7 @@
446446 /**
447447 * Get the username corresponding to a given user ID
448448 * @param $id Int User ID
449 - * @return String|false The corresponding username
 449+ * @return String|bool The corresponding username
450450 */
451451 public static function whoIs( $id ) {
452452 $dbr = wfGetDB( DB_SLAVE );
@@ -456,7 +456,7 @@
457457 * Get the real name of a user given their user ID
458458 *
459459 * @param $id Int User ID
460 - * @return String|false The corresponding user's real name
 460+ * @return String|bool The corresponding user's real name
461461 */
462462 public static function whoIsReal( $id ) {
463463 $dbr = wfGetDB( DB_SLAVE );
Index: trunk/phase3/includes/search/SearchEngine.php
@@ -91,7 +91,7 @@
9292 * @since 1.18
9393 * @param $feature String
9494 * @param $data Mixed
95 - * @return Noolean
 95+ * @return bool
9696 */
9797 public function setFeatureData( $feature, $data ) {
9898 $this->features[$feature] = $data;
@@ -771,7 +771,7 @@
772772 }
773773
774774 /**
775 - * @return Double or null if not supported
 775+ * @return Double|null if not supported
776776 */
777777 function getScore() {
778778 return null;
Index: trunk/phase3/includes/parser/Preprocessor_Hash.php
@@ -869,7 +869,7 @@
870870 * $args is optionally a multi-root PPNode or array containing the template arguments
871871 *
872872 * @param $args PPNode_Hash_Array|array
873 - * @param $title Title|false
 873+ * @param $title Title|bool
874874 *
875875 * @return PPTemplateFrame_Hash
876876 */
Index: trunk/phase3/includes/parser/Parser.php
@@ -616,7 +616,7 @@
617617 /**
618618 * Accessor/mutator for the Title object
619619 *
620 - * @param $x New Title object or null to just get the current one
 620+ * @param $x Title object or null to just get the current one
621621 * @return Title object
622622 */
623623 function Title( $x = null ) {
@@ -3671,7 +3671,7 @@
36723672 * Return the text to be used for a given extension tag.
36733673 * This is the ghost of strip().
36743674 *
3675 - * @param $params Associative array of parameters:
 3675+ * @param $params array Associative array of parameters:
36763676 * name PPNode for the tag name
36773677 * attr PPNode for unparsed text where tag attributes are thought to be
36783678 * attributes Optional associative array of parsed attributes
Index: trunk/phase3/includes/Linker.php
@@ -848,7 +848,7 @@
849849 * This will make a broken link if $file is false.
850850 *
851851 * @param $title Title object.
852 - * @param $file File|false mixed File object or false
 852+ * @param $file File|bool mixed File object or false
853853 * @param $html String: pre-sanitized HTML
854854 * @return String: HTML
855855 *
Index: trunk/phase3/includes/UserMailer.php
@@ -109,7 +109,7 @@
110110 /**
111111 * Creates a single string from an associative array
112112 *
113 - * @param $headers Associative Array: keys are header field names,
 113+ * @param $headers array Associative Array: keys are header field names,
114114 * values are ... values.
115115 * @param $endl String: The end of line character. Defaults to "\n"
116116 * @return String
Index: trunk/phase3/includes/HTMLForm.php
@@ -874,7 +874,7 @@
875875 *
876876 * @since 1.19
877877 *
878 - * @param string|false $action
 878+ * @param string|bool $action
879879 */
880880 public function setAction( $action ) {
881881 $this->mAction = $action;
Index: trunk/phase3/includes/revisiondelete/RevisionDeleter.php
@@ -43,7 +43,7 @@
4444 *
4545 * @param $n Integer: the new bitfield.
4646 * @param $o Integer: the old bitfield.
47 - * @return An array as described above.
 47+ * @return array An array as described above.
4848 * @since 1.19 public
4949 */
5050 public static function getChanges( $n, $o ) {
Index: trunk/phase3/includes/revisiondelete/RevisionDeleteAbstracts.php
@@ -196,7 +196,7 @@
197197
198198 /**
199199 * Get log parameter array.
200 - * @param $params Associative array of log parameters, same as updateLog()
 200+ * @param $params array Associative array of log parameters, same as updateLog()
201201 * @return array
202202 */
203203 public function getLogParams( $params ) {
Index: trunk/phase3/includes/OutputPage.php
@@ -1075,7 +1075,7 @@
10761076 /**
10771077 * Add new language links
10781078 *
1079 - * @param $newLinkArray Associative array mapping language code to the page
 1079+ * @param $newLinkArray array Associative array mapping language code to the page
10801080 * name
10811081 */
10821082 public function addLanguageLinks( $newLinkArray ) {
@@ -1085,7 +1085,7 @@
10861086 /**
10871087 * Reset the language links and add new language links
10881088 *
1089 - * @param $newLinkArray Associative array mapping language code to the page
 1089+ * @param $newLinkArray array Associative array mapping language code to the page
10901090 * name
10911091 */
10921092 public function setLanguageLinks( $newLinkArray ) {
@@ -1366,7 +1366,7 @@
13671367 /**
13681368 * Set the displayed file version
13691369 *
1370 - * @param $file File|false
 1370+ * @param $file File|bool
13711371 * @return Mixed: previous value
13721372 */
13731373 public function setFileVersion( $file ) {
Index: trunk/phase3/includes/logging/LogEventsList.php
@@ -606,7 +606,7 @@
607607 * @param $types String|Array Log types to show
608608 * @param $page String|Title The page title to show log entries for
609609 * @param $user String The user who made the log entries
610 - * @param $param Associative Array with the following additional options:
 610+ * @param $param array Associative Array with the following additional options:
611611 * - lim Integer Limit of items to show, default is 50
612612 * - conds Array Extra conditions for the query (e.g. "log_action != 'revision'")
613613 * - showIfEmpty boolean Set to false if you don't want any output in case the loglist is empty
Index: trunk/phase3/includes/logging/LogEntry.php
@@ -344,7 +344,7 @@
345345 *
346346 * @since 1.19
347347 *
348 - * @param $parameters Associative array
 348+ * @param $parameters array Associative array
349349 */
350350 public function setParameters( $parameters ) {
351351 $this->parameters = $parameters;
Index: trunk/phase3/includes/installer/PostgresInstaller.php
@@ -110,9 +110,9 @@
111111
112112 /**
113113 * Open a PG connection with given parameters
114 - * @param $user User name
115 - * @param $password Password
116 - * @param $dbName Database name
 114+ * @param $user string User name
 115+ * @param $password string Password
 116+ * @param $dbName string Database name
117117 * @return Status
118118 */
119119 protected function openConnectionWithParams( $user, $password, $dbName ) {
@@ -168,14 +168,14 @@
169169 * separate connection for this allows us to avoid accidental cross-module
170170 * dependencies.
171171 *
172 - * @param $type The type of connection to get:
 172+ * @param $type string The type of connection to get:
173173 * - create-db: A connection for creating DBs, suitable for pre-
174174 * installation.
175175 * - create-schema: A connection to the new DB, for creating schemas and
176176 * other similar objects in the new DB.
177177 * - create-tables: A connection with a role suitable for creating tables.
178178 *
179 - * @return A Status object. On success, a connection object will be in the
 179+ * @return Status object. On success, a connection object will be in the
180180 * value member.
181181 */
182182 protected function openPgConnection( $type ) {
@@ -365,10 +365,11 @@
366366
367367 /**
368368 * Recursive helper for canCreateObjectsForWebUser().
369 - * @param $conn Database object
370 - * @param $targetMember Role ID of the member to look for
371 - * @param $group Role ID of the group to look for
372 - * @param $maxDepth Maximum recursive search depth
 369+ * @param $conn DatabaseBase object
 370+ * @param $targetMember int Role ID of the member to look for
 371+ * @param $group int Role ID of the group to look for
 372+ * @param $maxDepth int Maximum recursive search depth
 373+ * @return bool
373374 */
374375 protected function isRoleMember( $conn, $targetMember, $group, $maxDepth ) {
375376 if ( $targetMember === $group ) {
Index: trunk/phase3/includes/WebRequest.php
@@ -838,7 +838,7 @@
839839 * Get a request header, or false if it isn't set
840840 * @param $name String: case-insensitive header name
841841 *
842 - * @return string|false
 842+ * @return string|bool
843843 */
844844 public function getHeader( $name ) {
845845 $this->initHeaders();
Index: trunk/phase3/includes/media/GIFMetadataExtractor.php
@@ -286,7 +286,7 @@
287287 * sub-blocks in the returned value. Normally this is false,
288288 * except XMP is weird and does a hack where you need to keep
289289 * these length bytes.
290 - * @return The data.
 290+ * @return string The data.
291291 */
292292 static function readBlock( $fh, $includeLengths = false ) {
293293 $data = '';
Index: trunk/phase3/includes/media/BitmapMetadataHandler.php
@@ -193,7 +193,7 @@
194194 * They don't really have native metadata, so just merges together
195195 * XMP and image comment.
196196 *
197 - * @param $filename full path to file
 197+ * @param $filename string full path to file
198198 * @return Array metadata array
199199 */
200200 static public function GIF ( $filename ) {
Index: trunk/phase3/includes/media/Generic.php
@@ -482,8 +482,8 @@
483483 * Check for zero-sized thumbnails. These can be generated when
484484 * no disk space is available or some other error occurs
485485 *
486 - * @param $dstPath The location of the suspect file
487 - * @param $retval Return value of some shell process, file will be deleted if this is non-zero
 486+ * @param $dstPath string The location of the suspect file
 487+ * @param $retval int Return value of some shell process, file will be deleted if this is non-zero
488488 * @return bool if removed, false otherwise
489489 */
490490 function removeBadFile( $dstPath, $retval = 0 ) {
Index: trunk/phase3/includes/PathRouter.php
@@ -123,9 +123,9 @@
124124 /**
125125 * Add a new path pattern to the path router
126126 *
127 - * @param $path The path pattern to add
128 - * @param $params The params for this path pattern
129 - * @param $options The options for this path pattern
 127+ * @param $path string The path pattern to add
 128+ * @param $params array The params for this path pattern
 129+ * @param $options array The options for this path pattern
130130 */
131131 public function add( $path, $params = array(), $options = array() ) {
132132 if ( is_array( $path ) ) {
@@ -195,7 +195,7 @@
196196 /**
197197 * Parse a path and return the query matches for the path
198198 *
199 - * @param $path The path to parse
 199+ * @param $path string The path to parse
200200 * @return Array The array of matches for the path
201201 */
202202 public function parse( $path ) {
Index: trunk/phase3/includes/MagicWord.php
@@ -813,7 +813,7 @@
814814 *
815815 * @param $text string
816816 *
817 - * @return string|false
 817+ * @return string|bool
818818 */
819819 public function matchStartToEnd( $text ) {
820820 $hash = $this->getHash();
@@ -861,7 +861,7 @@
862862 *
863863 * @param $text string
864864 *
865 - * @return int|false
 865+ * @return int|bool
866866 */
867867 public function matchStartAndRemove( &$text ) {
868868 $regexes = $this->getRegexStart();
Index: trunk/phase3/includes/Title.php
@@ -260,7 +260,7 @@
261261 * Load Title object fields from a DB row.
262262 * If false is given, the title will be treated as non-existing.
263263 *
264 - * @param $row Object|false database row
 264+ * @param $row Object|bool database row
265265 * @return void
266266 */
267267 public function loadFromRow( $row ) {
Index: trunk/phase3/includes/SkinTemplate.php
@@ -1345,7 +1345,7 @@
13461346 /**
13471347 * Get a Message object with its context set
13481348 *
1349 - * @param $name Str message name
 1349+ * @param $name string message name
13501350 * @return Message
13511351 */
13521352 public function getMsg( $name ) {
Index: trunk/phase3/includes/WikiPage.php
@@ -414,7 +414,7 @@
415415 * Revision::FOR_PUBLIC to be displayed to all users
416416 * Revision::FOR_THIS_USER to be displayed to $wgUser
417417 * Revision::RAW get the text regardless of permissions
418 - * @return String|false The text of the current revision
 418+ * @return String|bool The text of the current revision
419419 */
420420 public function getText( $audience = Revision::FOR_PUBLIC ) {
421421 $this->loadLastEdit();
@@ -427,7 +427,7 @@
428428 /**
429429 * Get the text of the current revision. No side-effects...
430430 *
431 - * @return String|false The text of the current revision
 431+ * @return String|bool The text of the current revision
432432 */
433433 public function getRawText() {
434434 $this->loadLastEdit();
@@ -1059,7 +1059,7 @@
10601060 * If the given revision is newer than the currently set page_latest,
10611061 * update the page record. Otherwise, do nothing.
10621062 *
1063 - * @param $dbw Database object
 1063+ * @param $dbw DatabaseBase object
10641064 * @param $revision Revision object
10651065 * @return mixed
10661066 */
Index: trunk/phase3/includes/HttpFunctions.php
@@ -417,8 +417,6 @@
418418 * Parses the headers, including the HTTP status code and any
419419 * Set-Cookie headers. This function expectes the headers to be
420420 * found in an array in the member variable headerList.
421 - *
422 - * @return nothing
423421 */
424422 protected function parseHeader() {
425423 $lastname = "";
@@ -446,8 +444,6 @@
447445 * RFC2616, section 10,
448446 * http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html for a
449447 * list of status codes.)
450 - *
451 - * @return nothing
452448 */
453449 protected function setStatus() {
454450 if ( !$this->respHeaders ) {
Index: trunk/phase3/includes/specials/SpecialRecentchanges.php
@@ -366,7 +366,7 @@
367367 *
368368 * @param $conds Array
369369 * @param $opts FormOptions
370 - * @return database result or false (for Recentchangeslinked only)
 370+ * @return bool|ResultWrapper result or false (for Recentchangeslinked only)
371371 */
372372 public function doMainQuery( $conds, $opts ) {
373373 $tables = array( 'recentchanges' );
Index: trunk/phase3/includes/specials/SpecialMostlinkedtemplates.php
@@ -75,7 +75,7 @@
7676 /**
7777 * Pre-cache page existence to speed up link generation
7878 *
79 - * @param $db Database connection
 79+ * @param $db DatabaseBase connection
8080 * @param $res ResultWrapper
8181 */
8282 public function preprocessResults( $db, $res ) {
Index: trunk/phase3/includes/specials/SpecialDeletedContributions.php
@@ -237,7 +237,7 @@
238238 /**
239239 * Get the Database object in use
240240 *
241 - * @return Database
 241+ * @return DatabaseBase
242242 */
243243 public function getDatabase() {
244244 return $this->mDb;
@@ -254,7 +254,6 @@
255255 * Special page "deleted user contributions".
256256 * Shows a list of the deleted contributions of a user.
257257 *
258 - * @return none
259258 * @param $par String: (optional) user name of the user for which to show the contributions
260259 */
261260 function execute( $par ) {
Index: trunk/phase3/includes/Skin.php
@@ -22,7 +22,7 @@
2323
2424 /**
2525 * Fetch the set of available skins.
26 - * @return associative array of strings
 26+ * @return array associative array of strings
2727 */
2828 static function getSkinNames() {
2929 global $wgValidSkinNames;
Index: trunk/phase3/includes/SpecialPage.php
@@ -200,7 +200,7 @@
201201 *
202202 * @param $user User object to check permissions, $wgUser will be used
203203 * if not provided
204 - * @return Associative array mapping page's name to its SpecialPage object
 204+ * @return array Associative array mapping page's name to its SpecialPage object
205205 * @deprecated since 1.18 call SpecialPageFactory method directly
206206 */
207207 static function getUsablePages( User $user = null ) {
@@ -211,7 +211,7 @@
212212 /**
213213 * Return categorised listable special pages for all users
214214 *
215 - * @return Associative array mapping page's name to its SpecialPage object
 215+ * @return array Associative array mapping page's name to its SpecialPage object
216216 * @deprecated since 1.18 call SpecialPageFactory method directly
217217 */
218218 static function getRegularPages() {
@@ -223,7 +223,7 @@
224224 * Return categorised listable special pages which are available
225225 * for the current user, but not for everyone
226226 *
227 - * @return Associative array mapping page's name to its SpecialPage object
 227+ * @return array Associative array mapping page's name to its SpecialPage object
228228 * @deprecated since 1.18 call SpecialPageFactory method directly
229229 */
230230 static function getRestrictedPages() {
@@ -988,7 +988,7 @@
989989 * False otherwise.
990990 *
991991 * @param $par String Subpage string
992 - * @return Title|false
 992+ * @return Title|bool
993993 */
994994 abstract public function getRedirect( $par );
995995
Index: trunk/phase3/includes/Pager.php
@@ -433,7 +433,7 @@
434434 * By default, all parameters passed in the URL are used, except for a
435435 * short blacklist.
436436 *
437 - * @return Associative array
 437+ * @return array Associative array
438438 */
439439 function getDefaultQuery() {
440440 if ( !isset( $this->mDefaultQuery ) ) {
Index: trunk/phase3/includes/IP.php
@@ -198,7 +198,7 @@
199199 *
200200 * A bare IPv6 address is accepted despite the lack of square brackets.
201201 *
202 - * @param $both The string with the host and port
 202+ * @param $both string The string with the host and port
203203 * @return array
204204 */
205205 public static function splitHostAndPort( $both ) {

Status & tagging log