r89104 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89103‎ | r89104 | r89105 >
Date:14:24, 29 May 2011
Author:reedy
Status:ok (Comments)
Tags:
Comment:
Even more documentation in various files
Modified paths:
  • /trunk/phase3/includes/Block.php (modified) (history)
  • /trunk/phase3/includes/ConfEditor.php (modified) (history)
  • /trunk/phase3/includes/ExternalStore.php (modified) (history)
  • /trunk/phase3/includes/GlobalFunctions.php (modified) (history)
  • /trunk/phase3/includes/HttpFunctions.php (modified) (history)
  • /trunk/phase3/includes/ImageFunctions.php (modified) (history)
  • /trunk/phase3/includes/Import.php (modified) (history)
  • /trunk/phase3/includes/actions/DeleteAction.php (modified) (history)
  • /trunk/phase3/includes/api/ApiFormatXml.php (modified) (history)
  • /trunk/phase3/includes/api/ApiPageSet.php (modified) (history)
  • /trunk/phase3/includes/cache/LinkBatch.php (modified) (history)
  • /trunk/phase3/includes/db/LBFactory_Single.php (modified) (history)
  • /trunk/phase3/includes/filerepo/LocalRepo.php (modified) (history)
  • /trunk/phase3/includes/job/DoubleRedirectJob.php (modified) (history)
  • /trunk/phase3/includes/media/BitmapMetadataHandler.php (modified) (history)
  • /trunk/phase3/includes/objectcache/DBABagOStuff.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/GlobalFunctions.php
@@ -86,6 +86,11 @@
8787 return array_udiff( $a, $b, 'wfArrayDiff2_cmp' );
8888 }
8989
 90+/**
 91+ * @param $a
 92+ * @param $b
 93+ * @return int
 94+ */
9095 function wfArrayDiff2_cmp( $a, $b ) {
9196 if ( !is_array( $a ) ) {
9297 return strcmp( $a, $b );
Index: trunk/phase3/includes/objectcache/DBABagOStuff.php
@@ -27,6 +27,8 @@
2828
2929 /**
3030 * Encode value and expiry for storage
 31+ * @param $value
 32+ * @param $expiry
3133 *
3234 * @return string
3335 */
Index: trunk/phase3/includes/db/LBFactory_Single.php
@@ -86,8 +86,8 @@
8787
8888 /**
8989 *
90 - * @param $server
91 - * @param $dbNameOverride
 90+ * @param $server string
 91+ * @param $dbNameOverride bool
9292 *
9393 * @return DatabaseBase
9494 */
Index: trunk/phase3/includes/filerepo/LocalRepo.php
@@ -49,13 +49,16 @@
5050 * filearchive table. This needs to be done in the repo because it needs to
5151 * interleave database locks with file operations, which is potentially a
5252 * remote operation.
 53+ *
 54+ * @param $storageKeys array
 55+ *
5356 * @return FileRepoStatus
5457 */
5558 function cleanupDeletedBatch( $storageKeys ) {
5659 $root = $this->getZonePath( 'deleted' );
5760 $dbw = $this->getMasterDB();
5861 $status = $this->newGood();
59 - $storageKeys = array_unique($storageKeys);
 62+ $storageKeys = array_unique( $storageKeys );
6063 foreach ( $storageKeys as $key ) {
6164 $hashPath = $this->getDeletedHashPath( $key );
6265 $path = "$root/$hashPath$key";
Index: trunk/phase3/includes/actions/DeleteAction.php
@@ -39,6 +39,8 @@
4040 * check that the page is not too big and has not already been deleted.
4141 * @throws ErrorPageError
4242 * @see Action::checkCanExecute
 43+ *
 44+ * @param $user User
4345 */
4446 protected function checkCanExecute( User $user ){
4547
Index: trunk/phase3/includes/api/ApiFormatXml.php
@@ -86,6 +86,13 @@
8787 *
8888 * If neither key is found, all keys become element names, and values become element content.
8989 * The method is recursive, so the same rules apply to any sub-arrays.
 90+ *
 91+ * @param $elemName
 92+ * @param $elemValue
 93+ * @param $indent
 94+ * @param $doublequote bool
 95+ *
 96+ * @return string
9097 */
9198 public static function recXmlPrint( $elemName, $elemValue, $indent, $doublequote = false ) {
9299 $retval = '';
Index: trunk/phase3/includes/api/ApiPageSet.php
@@ -59,6 +59,7 @@
6060 * Constructor
6161 * @param $query ApiQuery
6262 * @param $resolveRedirects bool Whether redirects should be resolved
 63+ * @param $convertTitles bool
6364 */
6465 public function __construct( $query, $resolveRedirects = false, $convertTitles = false ) {
6566 parent::__construct( $query, 'query' );
Index: trunk/phase3/includes/media/BitmapMetadataHandler.php
@@ -109,11 +109,11 @@
110110 }
111111
112112 /** Main entry point for jpeg's.
113 - *
114 - * @param string $file filename (with full path)
115 - * @return metadata result array.
116 - * @throws MWException on invalid file.
117 - */
 113+ *
 114+ * @param $filename string filename (with full path)
 115+ * @return metadata result array.
 116+ * @throws MWException on invalid file.
 117+ */
118118 static function Jpeg ( $filename ) {
119119 $showXMP = function_exists( 'xml_parser_create_ns' );
120120 $meta = new self();
@@ -143,14 +143,15 @@
144144 }
145145 return $meta->getMetadataArray();
146146 }
 147+
147148 /** Entry point for png
148 - * At some point in the future this might
149 - * merge the png various tEXt chunks to that
150 - * are interesting, but for now it only does XMP
151 - *
152 - * @param $filename String full path to file
153 - * @return Array Array for storage in img_metadata.
154 - */
 149+ * At some point in the future this might
 150+ * merge the png various tEXt chunks to that
 151+ * are interesting, but for now it only does XMP
 152+ *
 153+ * @param $filename String full path to file
 154+ * @return Array Array for storage in img_metadata.
 155+ */
155156 static public function PNG ( $filename ) {
156157 $showXMP = function_exists( 'xml_parser_create_ns' );
157158
Index: trunk/phase3/includes/cache/LinkBatch.php
@@ -59,6 +59,8 @@
6060 /**
6161 * Set the link list to a given 2-d array
6262 * First key is the namespace, second is the DB key, value arbitrary
 63+ *
 64+ * @param $array array
6365 */
6466 public function setArray( $array ) {
6567 $this->data = $array;
@@ -66,6 +68,8 @@
6769
6870 /**
6971 * Returns true if no pages have been added, false otherwise.
 72+ *
 73+ * @return bool
7074 */
7175 public function isEmpty() {
7276 return ($this->getSize() == 0);
@@ -73,6 +77,8 @@
7478
7579 /**
7680 * Returns the size of the batch.
 81+ *
 82+ * @return int
7783 */
7884 public function getSize() {
7985 return count( $this->data );
@@ -82,10 +88,10 @@
8389 * Do the query and add the results to the LinkCache object
8490 * Return an array mapping PDBK to ID
8591 */
86 - public function execute() {
87 - $linkCache = LinkCache::singleton();
88 - return $this->executeInto( $linkCache );
89 - }
 92+ public function execute() {
 93+ $linkCache = LinkCache::singleton();
 94+ return $this->executeInto( $linkCache );
 95+ }
9096
9197 /**
9298 * Do the query and add the results to a given LinkCache object
@@ -105,6 +111,9 @@
106112 * As normal, titles will go into the static Title cache field.
107113 * This function *also* stores extra fields of the title used for link
108114 * parsing to avoid extra DB queries.
 115+ *
 116+ * @param $cache
 117+ * @param $res
109118 */
110119 public function addResultToCache( $cache, $res ) {
111120 if ( !$res ) {
Index: trunk/phase3/includes/job/DoubleRedirectJob.php
@@ -23,7 +23,7 @@
2424 * Insert jobs into the job queue to fix redirects to the given title
2525 * @param $reason String: the reason for the fix, see message double-redirect-fixed-<reason>
2626 * @param $redirTitle Title: the title which has changed, redirects pointing to this title are fixed
27 - * @param $destTitle Not used
 27+ * @param $destTitle bool Not used
2828 */
2929 public static function fixRedirects( $reason, $redirTitle, $destTitle = false ) {
3030 # Need to use the master to get the redirect table updated in the same transaction
Index: trunk/phase3/includes/ConfEditor.php
@@ -84,6 +84,10 @@
8585
8686 /**
8787 * Simple entry point for command-line testing
 88+ *
 89+ * @param $text string
 90+ *
 91+ * @return string
8892 */
8993 static function test( $text ) {
9094 try {
Index: trunk/phase3/includes/ExternalStore.php
@@ -78,7 +78,10 @@
7979 * Store a data item to an external store, identified by a partial URL
8080 * The protocol part is used to identify the class, the rest is passed to the
8181 * class itself as a parameter.
82 - * @return string The URL of the stored data item, or false on error
 82+ * @param $url
 83+ * @param $data
 84+ * @param $params array
 85+ * @return string|false The URL of the stored data item, or false on error
8386 */
8487 static function insert( $url, $data, $params = array() ) {
8588 list( $proto, $params ) = explode( '://', $url, 2 );
Index: trunk/phase3/includes/HttpFunctions.php
@@ -53,6 +53,8 @@
5454 /**
5555 * Simple wrapper for Http::request( 'GET' )
5656 * @see Http::request()
 57+ *
 58+ * @return string
5759 */
5860 public static function get( $url, $timeout = 'default', $options = array() ) {
5961 $options['timeout'] = $timeout;
@@ -62,6 +64,8 @@
6365 /**
6466 * Simple wrapper for Http::request( 'POST' )
6567 * @see Http::request()
 68+ *
 69+ * @return string
6670 */
6771 public static function post( $url, $options = array() ) {
6872 return Http::request( 'POST', $url, $options );
Index: trunk/phase3/includes/Block.php
@@ -94,7 +94,6 @@
9595 *
9696 * @param $address String: IP address of user/anon
9797 * @param $user Integer: user id of user
98 - * @param $killExpired Boolean: delete expired blocks on load
9998 * @return Block Object
10099 * @deprecated since 1.18
101100 */
Index: trunk/phase3/includes/Import.php
@@ -39,7 +39,7 @@
4040
4141 /**
4242 * Creates an ImportXMLReader drawing from the source provided
43 - */
 43+ */
4444 function __construct( $source ) {
4545 $this->reader = new XMLReader();
4646
Index: trunk/phase3/includes/ImageFunctions.php
@@ -15,7 +15,7 @@
1616 * i.e. articles where the image may occur inline.
1717 *
1818 * @param $name string the image name to check
19 - * @param $contextTitle Title the page on which the image occurs, if known
 19+ * @param $contextTitle Title|bool the page on which the image occurs, if known
2020 * @return bool
2121 */
2222 function wfIsBadImage( $name, $contextTitle = false ) {

Comments

#Comment by Nikerabbit (talk | contribs)   17:28, 29 May 2011

You mean type hints :)?

#Comment by Reedy (talk | contribs)   17:29, 29 May 2011

It's a type of documentation! ;D

#Comment by Reach Out to the Truth (talk | contribs)   01:09, 30 May 2011

I welcome any sort of documentation. Keep it up. :)

Status & tagging log