r93015 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93014‎ | r93015 | r93016 >
Date:21:36, 24 July 2011
Author:reedy
Status:ok
Tags:
Comment:
Trim trailing whitespace

Add documentation

Remove unused variables

Remove an extract from ImageFunctionsTest
Modified paths:
  • /trunk/phase3/includes/PatrolLog.php (modified) (history)
  • /trunk/phase3/includes/WikiCategoryPage.php (modified) (history)
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)
  • /trunk/phase3/includes/parser/ParserCache.php (modified) (history)
  • /trunk/phase3/includes/parser/Preprocessor_HipHop.hphp (modified) (history)
  • /trunk/phase3/includes/specials/SpecialProtectedpages.php (modified) (history)
  • /trunk/phase3/includes/upload/UploadFromUrl.php (modified) (history)
  • /trunk/phase3/tests/phpunit/includes/GlobalFunctions/wfExpandUrl.php (modified) (history)
  • /trunk/phase3/tests/phpunit/includes/ImageFunctionsTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/includes/ImageFunctionsTest.php
@@ -32,7 +32,9 @@
3333 17 => 4,
3434 18 => 4 ) ) );
3535 foreach ( $vals as $row ) {
36 - extract( $row );
 36+ $tests = $row['tests'];
 37+ $height = $row['height'];
 38+ $width = $row['width'];
3739 foreach ( $tests as $max => $expected ) {
3840 $y = round( $expected * $height / $width );
3941 $result = wfFitBoxWidth( $width, $height, $max );
Index: trunk/phase3/tests/phpunit/includes/GlobalFunctions/wfExpandUrl.php
@@ -1,5 +1,5 @@
22 <?php
3 -/*
 3+/*
44 * Unit tests for wfExpandUrl()
55 */
66
@@ -11,6 +11,8 @@
1212
1313 /**
1414 * Provider of URL examples for testing wfExpandUrl()
 15+ *
 16+ * @return array
1517 */
1618 public function provideExpandableUrls() {
1719 global $wgServer;
Index: trunk/phase3/includes/upload/UploadFromUrl.php
@@ -19,10 +19,13 @@
2020 * user is allowed, pass on permissions checking to the parent.
2121 *
2222 * @param $user User
 23+ *
 24+ * @return bool
2325 */
2426 public static function isAllowed( $user ) {
25 - if ( !$user->isAllowed( 'upload_by_url' ) )
 27+ if ( !$user->isAllowed( 'upload_by_url' ) ) {
2628 return 'upload_by_url';
 29+ }
2730 return parent::isAllowed( $user );
2831 }
2932
Index: trunk/phase3/includes/parser/Parser.php
@@ -4190,10 +4190,10 @@
41914191 # split up and insert constructed headlines
41924192 $blocks = preg_split( '/<H[1-6].*?' . '>.*?<\/H[1-6]>/i', $text );
41934193 $i = 0;
4194 -
 4194+
41954195 // build an array of document sections
41964196 $sections = array();
4197 - foreach ( $blocks as $block ) {
 4197+ foreach ( $blocks as $block ) {
41984198 // $head is zero-based, sections aren't.
41994199 if ( empty( $head[$i - 1] ) ) {
42004200 $sections[$i] = $block;
@@ -4212,7 +4212,7 @@
42134213 * $showEditLinks : boolean describing whether this section has an edit link
42144214 */
42154215 wfRunHooks( 'ParserSectionCreate', array( $this, $i, &$sections[$i], $showEditLink ) );
4216 -
 4216+
42174217 $i++;
42184218 }
42194219
@@ -4221,9 +4221,9 @@
42224222 // Top anchor now in skin
42234223 $sections[0] = $sections[0] . $toc . "\n";
42244224 }
4225 -
 4225+
42264226 $full .= join( '', $sections );
4227 -
 4227+
42284228 if ( $this->mForceTocPosition ) {
42294229 return str_replace( '<!--MWTOC-->', $toc, $full );
42304230 } else {
@@ -5128,6 +5128,10 @@
51295129 *
51305130 * Transparent tag hooks are like regular XML-style tag hooks, except they
51315131 * operate late in the transformation sequence, on HTML instead of wikitext.
 5132+ *
 5133+ * @param $text string
 5134+ *
 5135+ * @return string
51325136 */
51335137 function replaceTransparentTags( $text ) {
51345138 $matches = array();
@@ -5414,6 +5418,10 @@
54155419 * Try to guess the section anchor name based on a wikitext fragment
54165420 * presumably extracted from a heading, for example "Header" from
54175421 * "== Header ==".
 5422+ *
 5423+ * @param $text string
 5424+ *
 5425+ * @return string
54185426 */
54195427 public function guessSectionNameFromWikiText( $text ) {
54205428 # Strip out wikitext links(they break the anchor)
Index: trunk/phase3/includes/parser/Preprocessor_HipHop.hphp
@@ -260,8 +260,8 @@
261261 if ( $found === 'angle' ) {
262262 $matches = false;
263263 // Handle </onlyinclude>
264 - if ( $enableOnlyinclude
265 - && substr( $text, $i, strlen( '</onlyinclude>' ) ) === '</onlyinclude>' )
 264+ if ( $enableOnlyinclude
 265+ && substr( $text, $i, strlen( '</onlyinclude>' ) ) === '</onlyinclude>' )
266266 {
267267 $findOnlyinclude = true;
268268 continue;
@@ -362,7 +362,7 @@
363363 }
364364
365365 $tagStartPos = $i;
366 - $inner = $close = '';
 366+ $close = '';
367367 if ( $text[$tagEndPos-1] === '/' ) {
368368 // Short end tag
369369 $attrEnd = $tagEndPos - 1;
Index: trunk/phase3/includes/parser/ParserCache.php
@@ -15,6 +15,8 @@
1616
1717 /**
1818 * Get an instance of this object
 19+ *
 20+ * @return ParserCache
1921 */
2022 public static function singleton() {
2123 static $instance;
Index: trunk/phase3/includes/PatrolLog.php
@@ -13,6 +13,8 @@
1414 *
1515 * @param $rc Mixed: change identifier or RecentChange object
1616 * @param $auto Boolean: was this patrol event automatic?
 17+ *
 18+ * @return bool
1719 */
1820 public static function record( $rc, $auto = false ) {
1921 if( !( $rc instanceof RecentChange ) ) {
Index: trunk/phase3/includes/specials/SpecialProtectedpages.php
@@ -83,7 +83,7 @@
8484 static $skin = null, $infinity = null;
8585
8686 if( is_null( $skin ) ){
87 - $skin = $wgUser->getSkin();
 87+ $skin = $this->getSkin();
8888 $infinity = wfGetDB( DB_SLAVE )->getInfinity();
8989 }
9090
Index: trunk/phase3/includes/WikiCategoryPage.php
@@ -6,6 +6,8 @@
77 /**
88 * Constructor from a page id
99 * @param $id Int article ID to load
 10+ *
 11+ * @return WikiCategoryPage
1012 */
1113 public static function newFromID( $id ) {
1214 $t = Title::newFromID( $id );
@@ -18,6 +20,8 @@
1921 * Don't return a 404 for categories in use.
2022 * In use defined as: either the actual page exists
2123 * or the category currently has members.
 24+ *
 25+ * @return bool
2226 */
2327 public function hasViewableContent() {
2428 if ( parent::hasViewableContent() ) {

Status & tagging log