r87231 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r87230‎ | r87231 | r87232 >
Date:23:54, 1 May 2011
Author:reedy
Status:ok
Tags:
Comment:
Documentation tweaks, additions and updates
Modified paths:
  • /trunk/phase3/includes/Wiki.php (modified) (history)
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)
  • /trunk/phase3/includes/parser/Preprocessor.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/parser/Parser.php
@@ -114,7 +114,7 @@
115115
116116 # Cleared with clearState():
117117 /**
118 - * @var OutputPage
 118+ * @var ParserOutput
119119 */
120120 var $mOutput;
121121 var $mAutonumber, $mDTopen;
@@ -988,7 +988,6 @@
989989 return $out;
990990 }
991991
992 -
993992 /**
994993 * Helper function for doTableStuff() separating the contents of cells from
995994 * attributes. Particularly useful as there's a possible bug and this action
@@ -1620,7 +1619,6 @@
16211620 return $attribs;
16221621 }
16231622
1624 -
16251623 /**
16261624 * Replace unusual URL escape codes with their equivalent characters
16271625 *
@@ -2127,6 +2125,8 @@
21282126 /**#@+
21292127 * Used by doBlockLevels()
21302128 * @private
 2129+ *
 2130+ * @return string
21312131 */
21322132 function closeParagraph() {
21332133 $result = '';
@@ -2162,6 +2162,8 @@
21632163 * These next three functions open, continue, and close the list
21642164 * element appropriate to the prefix character passed into them.
21652165 * @private
 2166+ *
 2167+ * @return string
21662168 */
21672169 function openList( $char ) {
21682170 $result = $this->closeParagraph();
@@ -2186,6 +2188,8 @@
21872189 * TODO: document
21882190 * @param $char String
21892191 * @private
 2192+ *
 2193+ * @return string
21902194 */
21912195 function nextItem( $char ) {
21922196 if ( '*' === $char || '#' === $char ) {
@@ -2210,6 +2214,8 @@
22112215 * TODO: document
22122216 * @param $char String
22132217 * @private
 2218+ *
 2219+ * @return string
22142220 */
22152221 function closeList( $char ) {
22162222 if ( '*' === $char ) {
@@ -2585,6 +2591,9 @@
25862592 * Return value of a magic variable (like PAGENAME)
25872593 *
25882594 * @private
 2595+ *
 2596+ * @param $index integer
 2597+ * @param $frame PPFrame
25892598 */
25902599 function getVariableValue( $index, $frame=false ) {
25912600 global $wgContLang, $wgSitename, $wgServer;
@@ -2933,6 +2942,8 @@
29342943 * dependency requirements.
29352944 *
29362945 * @private
 2946+ *
 2947+ * @return PPNode
29372948 */
29382949 function preprocessToDom( $text, $flags = 0 ) {
29392950 $dom = $this->getPreprocessor()->preprocessToObj( $text, $flags );
@@ -2941,6 +2952,8 @@
29422953
29432954 /**
29442955 * Return a three-element array: leading whitespace, string contents, trailing whitespace
 2956+ *
 2957+ * @return array
29452958 */
29462959 public static function splitWhitespace( $s ) {
29472960 $ltrimmed = ltrim( $s );
@@ -2971,6 +2984,8 @@
29722985 * Providing arguments this way may be useful for extensions wishing to perform variable replacement explicitly.
29732986 * @param $argsOnly Boolean: only do argument (triple-brace) expansion, not double-brace expansion
29742987 * @private
 2988+ *
 2989+ * @return string
29752990 */
29762991 function replaceVariables( $text, $frame = false, $argsOnly = false ) {
29772992 # Is there any text? Also, Prevent too big inclusions!
@@ -2994,7 +3009,11 @@
29953010 return $text;
29963011 }
29973012
2998 - # Clean up argument array - refactored in 1.9 so parserfunctions can use it, too.
 3013+ /**
 3014+ * Clean up argument array - refactored in 1.9 so parserfunctions can use it, too.
 3015+ *
 3016+ * @return array
 3017+ */
29993018 static function createAssocArgs( $args ) {
30003019 $assocArgs = array();
30013020 $index = 1;
@@ -3376,6 +3395,8 @@
33773396 /**
33783397 * Get the semi-parsed DOM representation of a template with a given title,
33793398 * and its redirect destination title. Cached.
 3399+ *
 3400+ * @return array
33803401 */
33813402 function getTemplateDom( $title ) {
33823403 $cacheTitle = $title;
@@ -3440,8 +3461,10 @@
34413462 /**
34423463 * Static function to get a template
34433464 * Can be overridden via ParserOptions::setTemplateCallback().
 3465+ *
 3466+ * @return array
34443467 */
3445 - static function statelessFetchTemplate( $title, $parser=false ) {
 3468+ static function statelessFetchTemplate( $title, $parser = false ) {
34463469 $text = $skip = false;
34473470 $finalTitle = $title;
34483471 $deps = array();
@@ -3553,6 +3576,8 @@
35543577
35553578 /**
35563579 * Transclude an interwiki link.
 3580+ *
 3581+ * @return string
35573582 */
35583583 function interwikiTransclude( $title, $action ) {
35593584 global $wgEnableScaryTranscluding;
@@ -3569,6 +3594,10 @@
35703595 return $this->fetchScaryTemplateMaybeFromCache( $url );
35713596 }
35723597
 3598+ /**
 3599+ * @param $url string
 3600+ * @return Mixed|String
 3601+ */
35733602 function fetchScaryTemplateMaybeFromCache( $url ) {
35743603 global $wgTranscludeCacheExpiry;
35753604 $dbr = wfGetDB( DB_SLAVE );
@@ -3593,10 +3622,14 @@
35943623 return $text;
35953624 }
35963625
3597 -
35983626 /**
35993627 * Triple brace replacement -- used for template arguments
36003628 * @private
 3629+ *
 3630+ * @param $peice array
 3631+ * @param $frame PPFrame
 3632+ *
 3633+ * @return array
36013634 */
36023635 function argSubstitution( $piece, $frame ) {
36033636 wfProfileIn( __METHOD__ );
@@ -3650,6 +3683,8 @@
36513684 * inner Contents of extension element
36523685 * noClose Original text did not have a close tag
36533686 * @param $frame PPFrame
 3687+ *
 3688+ * @return string
36543689 */
36553690 function extensionSubstitution( $params, $frame ) {
36563691 $name = $frame->expand( $params['name'] );
@@ -5236,10 +5271,10 @@
52375272 * This function returns $oldtext after the content of the section
52385273 * specified by $section has been replaced with $text.
52395274 *
5240 - * @param $text String: former text of the article
 5275+ * @param $oldtext String: former text of the article
52415276 * @param $section Numeric: section identifier
52425277 * @param $text String: replacing text
5243 - * #return String: modified text
 5278+ * @return String: modified text
52445279 */
52455280 public function replaceSection( $oldtext, $section, $text ) {
52465281 return $this->extractSections( $oldtext, $section, "replace", $text );
@@ -5257,7 +5292,7 @@
52585293 /**
52595294 * Get the revision object for $this->mRevisionId
52605295 *
5261 - * @return either a Revision object or null
 5296+ * @return Revision|null either a Revision object or null
52625297 */
52635298 protected function getRevisionObject() {
52645299 if ( !is_null( $this->mRevisionObject ) ) {
@@ -5418,6 +5453,8 @@
54195454
54205455 /**
54215456 * strip/replaceVariables/unstrip for preprocessor regression testing
 5457+ *
 5458+ * @return string
54225459 */
54235460 function testSrvus( $text, $title, ParserOptions $options, $outputType = self::OT_HTML ) {
54245461 if ( !$title instanceof Title ) {
@@ -5456,6 +5493,8 @@
54575494 * This will call the callback function twice, with 'aaa' and 'bbb'. Those
54585495 * two strings will be replaced with the value returned by the callback in
54595496 * each case.
 5497+ *
 5498+ * @return string
54605499 */
54615500 function markerSkipCallback( $s, $callback ) {
54625501 $i = 0;
@@ -5492,6 +5531,8 @@
54935532 * array can later be loaded into another parser instance with
54945533 * unserializeHalfParsedText(). The text can then be safely incorporated into
54955534 * the return value of a parser hook.
 5535+ *
 5536+ * @return array
54965537 */
54975538 function serializeHalfParsedText( $text ) {
54985539 wfProfileIn( __METHOD__ );
@@ -5540,7 +5581,9 @@
55415582 * serializeHalfParsedText(), is compatible with the current version of the
55425583 * parser.
55435584 *
5544 - * @param $data Array.
 5585+ * @param $data Array
 5586+ *
 5587+ * @return bool
55455588 */
55465589 function isValidHalfParsedText( $data ) {
55475590 return isset( $data['version'] ) && $data['version'] == self::HALF_PARSED_VERSION;
Index: trunk/phase3/includes/parser/Preprocessor.php
@@ -12,16 +12,28 @@
1313 /** Create a new preprocessor object based on an initialised Parser object */
1414 function __construct( $parser );
1515
16 - /** Create a new top-level frame for expansion of a page */
 16+ /**
 17+ * Create a new top-level frame for expansion of a page
 18+ *
 19+ * @return PPFrame
 20+ */
1721 function newFrame();
1822
19 - /** Create a new custom frame for programmatic use of parameter replacement as used in some extensions */
 23+ /**
 24+ * Create a new custom frame for programmatic use of parameter replacement as used in some extensions
 25+ *
 26+ * @return PPFrame
 27+ */
2028 function newCustomFrame( $args );
2129
2230 /** Create a new custom node for programmatic use of parameter replacement as used in some extensions */
2331 function newPartNodeArray( $values );
2432
25 - /** Preprocess text to a PPNode */
 33+ /**
 34+ * Preprocess text to a PPNode
 35+ *
 36+ * @return PPNode
 37+ */
2638 function preprocessToObj( $text, $flags = 0 );
2739 }
2840
@@ -126,6 +138,8 @@
127139
128140 /**
129141 * Get the first child of a tree node. False if there isn't one.
 142+ *
 143+ * @return PPNode
130144 */
131145 function getFirstChild();
132146
Index: trunk/phase3/includes/Wiki.php
@@ -264,6 +264,7 @@
265265 * Create an Article object of the appropriate class for the given page.
266266 *
267267 * @param $title Title
 268+ * @param $context RequestContext
268269 * @return Article object
269270 */
270271 public static function articleFromTitle( &$title, RequestContext &$context ) {

Status & tagging log