r82490 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82489‎ | r82490 | r82491 >
Date:21:44, 19 February 2011
Author:reedy
Status:ok (Comments)
Tags:
Comment:
Explicitally define variables
Modified paths:
  • /trunk/phase3/includes/diff/DifferenceEngine.php (modified) (history)
  • /trunk/phase3/includes/diff/WikiDiff.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/diff/WikiDiff.php
@@ -137,6 +137,13 @@
138138
139139 protected $xchanged, $ychanged;
140140
 141+ protected $xv = array(), $yv = array();
 142+ protected $xind = array(), $yind = array();
 143+
 144+ protected $seq = array(), $in_seq = array();
 145+
 146+ protected $lcs = 0;
 147+
141148 function diff ( $from_lines, $to_lines ) {
142149 wfProfileIn( __METHOD__ );
143150
@@ -841,8 +848,7 @@
842849 }
843850 }
844851 $context = $edit->orig;
845 - }
846 - else {
 852+ } else {
847853 if ( ! is_array( $block ) ) {
848854 $context = array_slice( $context, sizeof( $context ) - $nlead );
849855 $x0 = $xi - sizeof( $context );
Index: trunk/phase3/includes/diff/DifferenceEngine.php
@@ -25,8 +25,16 @@
2626 var $mOldid, $mNewid, $mTitle;
2727 var $mOldtitle, $mNewtitle, $mPagetitle;
2828 var $mOldtext, $mNewtext;
 29+
 30+ /**
 31+ * @var Title
 32+ */
2933 var $mOldPage, $mNewPage;
3034 var $mRcidMarkPatrolled;
 35+
 36+ /**
 37+ * @var Revision
 38+ */
3139 var $mOldRev, $mNewRev;
3240 var $mRevisionsLoaded = false; // Have the revisions been loaded
3341 var $mTextLoaded = 0; // How many text blobs have been loaded, 0, 1 or 2?
@@ -401,6 +409,10 @@
402410 wfProfileOut( __METHOD__ );
403411 }
404412
 413+ /**
 414+ * @param $rev Revision
 415+ * @return String
 416+ */
405417 protected function revisionDeleteLink( $rev ) {
406418 global $wgUser;
407419 $link = '';

Comments

#Comment by Hashar (talk | contribs)   09:44, 22 February 2011

I like explicit variables declarations, but would it be possible to document them meanwhile? :-)

#Comment by Reedy (talk | contribs)   11:35, 22 February 2011

Well, as you can see, I am doing some where they aren't initalised with an obvious default that's the type it's used (ie bool or null)

#Comment by Hashar (talk | contribs)   19:51, 23 February 2011

I was actually teasing you about the WikiDiff properties which are a bit long to document. You can ignore this request :o)

Status & tagging log