Fix a few incorrect annotations
authorErik Bernhardson <ebernhardson@wikimedia.org>
Fri, 1 Jul 2016 00:08:44 +0000 (17:08 -0700)
committerErik Bernhardson <ebernhardson@wikimedia.org>
Fri, 1 Jul 2016 00:50:40 +0000 (17:50 -0700)
Found by applying etsy/phan to the mediawiki codebase, in preparation
for getting it running more regularly via CI. Has no effect on how the
code runs, simply does a better job of documenting the code.

Change-Id: I4c844a51df3ffe4fbb96cac25f3eff2f7a9faca2

includes/api/ApiMain.php
includes/content/AbstractContent.php
includes/db/DatabaseOracle.php
includes/db/DatabasePostgres.php
includes/filerepo/FileRepo.php
includes/jobqueue/jobs/DoubleRedirectJob.php
includes/specialpage/ChangesListSpecialPage.php
includes/specials/SpecialRandomInCategory.php
includes/specials/SpecialRecentchanges.php
maintenance/dumpTextPass.php
maintenance/preprocessorFuzzTest.php

index a9541d3..278341d 100644 (file)
@@ -138,7 +138,9 @@ class ApiMain extends ApiBase {
         */
        private $mPrinter;
 
-       private $mModuleMgr, $mResult, $mErrorFormatter, $mContinuationManager;
+       private $mModuleMgr, $mResult, $mErrorFormatter;
+       /** @var ApiContinuationManager|null */
+       private $mContinuationManager;
        private $mAction;
        private $mEnableWrite;
        private $mInternalMode, $mSquidMaxage;
index e744655..811b241 100644 (file)
@@ -281,7 +281,7 @@ abstract class AbstractContent implements Content {
         *
         * @since 1.21
         *
-        * @return null
+        * @return Title|null
         *
         * @see Content::getRedirectTarget
         */
index 9e53653..f9ba050 100644 (file)
@@ -432,7 +432,7 @@ class DatabaseOracle extends Database {
 
        /**
         * Frees resources associated with the LOB descriptor
-        * @param ResultWrapper|resource $res
+        * @param ResultWrapper|ORAResult $res
         */
        function freeResult( $res ) {
                if ( $res instanceof ResultWrapper ) {
@@ -443,7 +443,7 @@ class DatabaseOracle extends Database {
        }
 
        /**
-        * @param ResultWrapper|stdClass $res
+        * @param ResultWrapper|ORAResult $res
         * @return mixed
         */
        function fetchObject( $res ) {
@@ -454,6 +454,10 @@ class DatabaseOracle extends Database {
                return $res->fetchObject();
        }
 
+       /**
+        * @param ResultWrapper|ORAResult $res
+        * @return mixed
+        */
        function fetchRow( $res ) {
                if ( $res instanceof ResultWrapper ) {
                        $res = $res->result;
@@ -462,6 +466,10 @@ class DatabaseOracle extends Database {
                return $res->fetchRow();
        }
 
+       /**
+        * @param ResultWrapper|ORAResult $res
+        * @return int
+        */
        function numRows( $res ) {
                if ( $res instanceof ResultWrapper ) {
                        $res = $res->result;
@@ -470,6 +478,10 @@ class DatabaseOracle extends Database {
                return $res->numRows();
        }
 
+       /**
+        * @param ResultWrapper|ORAResult $res
+        * @return int
+        */
        function numFields( $res ) {
                if ( $res instanceof ResultWrapper ) {
                        $res = $res->result;
index 839d6a0..c9127ff 100644 (file)
@@ -1383,6 +1383,11 @@ SQL;
                return (bool)$exists;
        }
 
+       /**
+        * @var string $table
+        * @var string $field
+        * @return PostgresField|null
+        */
        function fieldInfo( $table, $field ) {
                return PostgresField::fromText( $this, $table, $field );
        }
index 9ad2428..d7559d0 100644 (file)
@@ -533,11 +533,10 @@ class FileRepo {
        public function findFileFromKey( $sha1, $options = [] ) {
                $time = isset( $options['time'] ) ? $options['time'] : false;
                # First try to find a matching current version of a file...
-               if ( $this->fileFactoryKey ) {
-                       $img = call_user_func( $this->fileFactoryKey, $sha1, $this, $time );
-               } else {
+               if ( !$this->fileFactoryKey ) {
                        return false; // find-by-sha1 not supported
                }
+               $img = call_user_func( $this->fileFactoryKey, $sha1, $this, $time );
                if ( $img && $img->exists() ) {
                        return $img;
                }
index c6d8ec5..3cd3448 100644 (file)
@@ -179,7 +179,8 @@ class DoubleRedirectJob extends Job {
         *
         * @param Title $title
         *
-        * @return bool If the specified title is not a redirect, or if it is a circular redirect
+        * @return Title|bool The final Title after following all redirects, or false if
+        *  the page is not a redirect or the redirect loops.
         */
        public static function getFinalDestination( $title ) {
                $dbw = wfGetDB( DB_MASTER );
index 0bd2932..6c061b3 100644 (file)
@@ -368,7 +368,7 @@ abstract class ChangesListSpecialPage extends SpecialPage {
        /**
         * Build and output the actual changes list.
         *
-        * @param array $rows Database rows
+        * @param ResultWrapper $rows Database rows
         * @param FormOptions $opts
         */
        abstract public function outputChangesList( $rows, $opts );
index efb1748..a5e538f 100644 (file)
  * @ingroup SpecialPage
  */
 class SpecialRandomInCategory extends FormSpecialPage {
+       /** @var string[] */
        protected $extra = []; // Extra SQL statements
+       /** @var Title|false */
        protected $category = false; // Title object of category
+       /** @var int */
        protected $maxOffset = 30; // Max amount to fudge randomness by.
+       /** @var int|null */
        private $maxTimestamp = null;
+       /** @var int|null */
        private $minTimestamp = null;
 
        public function __construct( $name = 'RandomInCategory' ) {
index 4d6cb7c..d4fb72c 100644 (file)
@@ -310,7 +310,7 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
        /**
         * Build and output the actual changes list.
         *
-        * @param array $rows Database rows
+        * @param ResultWrapper $rows Database rows
         * @param FormOptions $opts
         */
        public function outputChangesList( $rows, $opts ) {
index 6d5a0e9..cfb59c6 100644 (file)
@@ -74,6 +74,9 @@ class TextPassDumper extends BackupDumper {
         */
        protected $spawnErr = false;
 
+       /**
+        * @var bool|XmlDumpWriter
+        */
        protected $xmlwriterobj = false;
 
        protected $timeExceeded = false;
index aa5d69d..d102e08 100644 (file)
@@ -47,6 +47,9 @@ class PPFuzzTester {
        public $entryPoints = [ 'testSrvus', 'testPst', 'testPreprocess' ];
        public $verbose = false;
 
+       /**
+        * @var bool|PPFuzzTest
+        */
        private static $currentTest = false;
 
        function execute() {