Trim trailing whitespace
authorSam Reed <reedy@users.mediawiki.org>
Sun, 24 Jul 2011 21:36:04 +0000 (21:36 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Sun, 24 Jul 2011 21:36:04 +0000 (21:36 +0000)
Add documentation

Remove unused variables

Remove an extract from ImageFunctionsTest

includes/PatrolLog.php
includes/WikiCategoryPage.php
includes/parser/Parser.php
includes/parser/ParserCache.php
includes/parser/Preprocessor_HipHop.hphp
includes/specials/SpecialProtectedpages.php
includes/upload/UploadFromUrl.php
tests/phpunit/includes/GlobalFunctions/wfExpandUrl.php
tests/phpunit/includes/ImageFunctionsTest.php

index 480337a..9a23b1a 100644 (file)
@@ -13,6 +13,8 @@ class PatrolLog {
         *
         * @param $rc Mixed: change identifier or RecentChange object
         * @param $auto Boolean: was this patrol event automatic?
+        *
+        * @return bool
         */
        public static function record( $rc, $auto = false ) {
                if( !( $rc instanceof RecentChange ) ) {
index 42c2a6c..1bbc691 100644 (file)
@@ -6,6 +6,8 @@ class WikiCategoryPage extends WikiPage {
        /**
         * Constructor from a page id
         * @param $id Int article ID to load
+        *
+        * @return WikiCategoryPage
         */
        public static function newFromID( $id ) {
                $t = Title::newFromID( $id );
@@ -18,6 +20,8 @@ class WikiCategoryPage extends WikiPage {
         * Don't return a 404 for categories in use.
         * In use defined as: either the actual page exists
         * or the category currently has members.
+        *
+        * @return bool
         */
        public function hasViewableContent() {
                if ( parent::hasViewableContent() ) {
index 447ffa5..f19d96d 100644 (file)
@@ -4190,10 +4190,10 @@ class Parser {
                # split up and insert constructed headlines
                $blocks = preg_split( '/<H[1-6].*?' . '>.*?<\/H[1-6]>/i', $text );
                $i = 0;
-               
+
                // build an array of document sections
                $sections = array();
-               foreach ( $blocks as $block ) {                 
+               foreach ( $blocks as $block ) {
                        // $head is zero-based, sections aren't.
                        if ( empty( $head[$i - 1] ) ) {
                                $sections[$i] = $block;
@@ -4212,7 +4212,7 @@ class Parser {
                         * $showEditLinks : boolean describing whether this section has an edit link
                         */
                        wfRunHooks( 'ParserSectionCreate', array( $this, $i, &$sections[$i], $showEditLink ) );
-               
+
                        $i++;
                }
 
@@ -4221,9 +4221,9 @@ class Parser {
                        // Top anchor now in skin
                        $sections[0] = $sections[0] . $toc . "\n";
                }
-               
+
                $full .= join( '', $sections );
-               
+
                if ( $this->mForceTocPosition ) {
                        return str_replace( '<!--MWTOC-->', $toc, $full );
                } else {
@@ -5128,6 +5128,10 @@ class Parser {
         *
         * Transparent tag hooks are like regular XML-style tag hooks, except they
         * operate late in the transformation sequence, on HTML instead of wikitext.
+        *
+        * @param $text string
+        *
+        * @return string
         */
        function replaceTransparentTags( $text ) {
                $matches = array();
@@ -5414,6 +5418,10 @@ class Parser {
         * Try to guess the section anchor name based on a wikitext fragment
         * presumably extracted from a heading, for example "Header" from
         * "== Header ==".
+        *
+        * @param $text string
+        *
+        * @return string
         */
        public function guessSectionNameFromWikiText( $text ) {
                # Strip out wikitext links(they break the anchor)
index 2941541..9515859 100644 (file)
@@ -15,6 +15,8 @@ class ParserCache {
 
        /**
         * Get an instance of this object
+        *
+        * @return ParserCache
         */
        public static function singleton() {
                static $instance;
index dc404f7..9048d31 100644 (file)
@@ -260,8 +260,8 @@ class Preprocessor_HipHop implements Preprocessor {
                        if ( $found === 'angle' ) {
                                $matches = false;
                                // Handle </onlyinclude>
-                               if ( $enableOnlyinclude 
-                                       && substr( $text, $i, strlen( '</onlyinclude>' ) ) === '</onlyinclude>' ) 
+                               if ( $enableOnlyinclude
+                                       && substr( $text, $i, strlen( '</onlyinclude>' ) ) === '</onlyinclude>' )
                                {
                                        $findOnlyinclude = true;
                                        continue;
@@ -362,7 +362,7 @@ class Preprocessor_HipHop implements Preprocessor {
                                }
 
                                $tagStartPos = $i;
-                               $inner = $close = '';
+                               $close = '';
                                if ( $text[$tagEndPos-1] === '/' ) {
                                        // Short end tag
                                        $attrEnd = $tagEndPos - 1;
index b1f61f0..19b9760 100644 (file)
@@ -83,7 +83,7 @@ class SpecialProtectedpages extends SpecialPage {
                static $skin = null, $infinity = null;
 
                if( is_null( $skin ) ){
-                       $skin = $wgUser->getSkin();
+                       $skin = $this->getSkin();
                        $infinity = wfGetDB( DB_SLAVE )->getInfinity();
                }
 
index e8178cd..f9abffe 100644 (file)
@@ -19,10 +19,13 @@ class UploadFromUrl extends UploadBase {
         * user is allowed, pass on permissions checking to the parent.
         *
         * @param $user User
+        *
+        * @return bool
         */
        public static function isAllowed( $user ) {
-               if ( !$user->isAllowed( 'upload_by_url' ) )
+               if ( !$user->isAllowed( 'upload_by_url' ) ) {
                        return 'upload_by_url';
+               }
                return parent::isAllowed( $user );
        }
 
index c0875db..624ee8c 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-/* 
+/*
  * Unit tests for wfExpandUrl()
  */
 
@@ -11,6 +11,8 @@ class wfExpandUrl extends MediaWikiTestCase {
 
        /**
         * Provider of URL examples for testing wfExpandUrl()
+        *
+        * @return array
         */
        public function provideExpandableUrls() {
                global $wgServer;
index cb7e67f..d6518b0 100644 (file)
@@ -32,7 +32,9 @@ class ImageFunctionsTest extends MediaWikiTestCase {
                                        17 => 4,
                                        18 => 4 ) ) );
                foreach ( $vals as $row ) {
-                       extract( $row );
+                       $tests = $row['tests'];
+                       $height = $row['height'];
+                       $width = $row['width'];
                        foreach ( $tests as $max => $expected ) {
                                $y = round( $expected * $height / $width );
                                $result = wfFitBoxWidth( $width, $height, $max );