Improve (weak and strict) type hints invarious places
authorThiemo Mättig <thiemo.maettig@wikimedia.de>
Thu, 28 Dec 2017 15:31:56 +0000 (16:31 +0100)
committerThiemo Mättig <thiemo.maettig@wikimedia.de>
Thu, 28 Dec 2017 15:31:56 +0000 (16:31 +0100)
Change-Id: I3a42ec1547fae971d7b495c99dd144739d8521ab

includes/OutputPage.php
includes/Title.php
includes/cache/CacheDependency.php
includes/content/Content.php
includes/context/MutableContext.php
includes/context/RequestContext.php
includes/installer/DatabaseUpdater.php
includes/search/SearchExactMatchRescorer.php
includes/specials/pagers/ContribsPager.php

index 1c2c29d..a2d445f 100644 (file)
@@ -366,8 +366,8 @@ class OutputPage extends ContextSource {
         * Add a new "<meta>" tag
         * To add an http-equiv meta tag, precede the name with "http:"
         *
-        * @param string $name Tag name
-        * @param string $val Tag value
+        * @param string $name Name of the meta tag
+        * @param string $val Value of the meta tag
         */
        function addMeta( $name, $val ) {
                array_push( $this->mMetatags, [ $name, $val ] );
index b23bd5a..3de85e1 100644 (file)
@@ -4644,7 +4644,7 @@ class Title implements LinkTarget {
        /**
         * Get the last touched timestamp
         *
-        * @param IDatabase $db Optional db
+        * @param IDatabase|null $db
         * @return string|false Last-touched timestamp
         */
        public function getTouched( $db = null ) {
index a59ba97..dd4c49e 100644 (file)
@@ -34,7 +34,6 @@ class DependencyWrapper {
        private $deps;
 
        /**
-        * Create an instance.
         * @param mixed $value The user-supplied value
         * @param CacheDependency|CacheDependency[] $deps A dependency or dependency
         *   array. All dependencies must be objects implementing CacheDependency.
index 6a0a63b..3e58782 100644 (file)
@@ -483,11 +483,11 @@ interface Content {
         * @since 1.21
         *
         * @param WikiPage $page The deleted page
-        * @param ParserOutput $parserOutput Optional parser output object
+        * @param ParserOutput|null $parserOutput Optional parser output object
         *    for efficient access to meta-information about the content object.
         *    Provide if you have one handy.
         *
-        * @return DataUpdate[] A list of DataUpdate instances that will clean up the
+        * @return DeferrableUpdate[] A list of DeferrableUpdate instances that will clean up the
         *    database after deletion.
         */
        public function getDeletionUpdates( WikiPage $page,
index 6358f11..189b346 100644 (file)
@@ -26,9 +26,9 @@ interface MutableContext {
        /**
         * Set the Config object
         *
-        * @param Config $c
+        * @param Config $config
         */
-       public function setConfig( Config $c );
+       public function setConfig( Config $config );
 
        /**
         * Set the WebRequest object
index c2d0de1..cf5c939 100644 (file)
@@ -81,17 +81,13 @@ class RequestContext implements IContextSource, MutableContext {
        private static $instance = null;
 
        /**
-        * Set the Config object
-        *
-        * @param Config $c
+        * @param Config $config
         */
-       public function setConfig( Config $c ) {
-               $this->config = $c;
+       public function setConfig( Config $config ) {
+               $this->config = $config;
        }
 
        /**
-        * Get the Config object
-        *
         * @return Config
         */
        public function getConfig() {
index 54ff712..242f148 100644 (file)
@@ -179,12 +179,12 @@ abstract class DatabaseUpdater {
        /**
         * @param Database $db
         * @param bool $shared
-        * @param Maintenance $maintenance
+        * @param Maintenance|null $maintenance
         *
         * @throws MWException
         * @return DatabaseUpdater
         */
-       public static function newForDB( Database $db, $shared = false, $maintenance = null ) {
+       public static function newForDB( Database $db, $shared = false, Maintenance $maintenance = null ) {
                $type = $db->getType();
                if ( in_array( $type, Installer::getDBTypes() ) ) {
                        $class = ucfirst( $type ) . 'Updater';
@@ -616,7 +616,7 @@ abstract class DatabaseUpdater {
         * 1.13...) with the values being arrays of updates, identical to how
         * updaters.inc did it (for now)
         *
-        * @return array
+        * @return array[]
         */
        abstract protected function getCoreUpdateList();
 
index 0e99ba9..2687c8e 100644 (file)
@@ -100,7 +100,7 @@ class SearchExactMatchRescorer {
         * @return array redirect target prefixedText to index of title in titles
         *   that is a redirect to it.
         */
-       private function redirectTargetsToRedirect( $titles ) {
+       private function redirectTargetsToRedirect( array $titles ) {
                $result = [];
                foreach ( $titles as $key => $titleText ) {
                        $title = Title::newFromText( $titleText );
@@ -122,7 +122,7 @@ class SearchExactMatchRescorer {
         * @param int $key key to pull to the front
         * @return array $array with the item at $key pulled to the front
         */
-       private function pullFront( $key, $array ) {
+       private function pullFront( $key, array $array ) {
                $cut = array_splice( $array, $key, 1 );
                array_unshift( $array, $cut[0] );
                return $array;
index 85faddc..c3fa2b1 100644 (file)
@@ -634,7 +634,7 @@ class ContribsPager extends RangeChronologicalPager {
         * @param array $opts Options array
         * @return array Options array with processed start and end date filter options
         */
-       public static function processDateFilter( $opts ) {
+       public static function processDateFilter( array $opts ) {
                $start = isset( $opts['start'] ) ? $opts['start'] : '';
                $end = isset( $opts['end'] ) ? $opts['end'] : '';
                $year = isset( $opts['year'] ) ? $opts['year'] : '';