From fa15c987874009401f73f39cb06430c24a0ce9d7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thiemo=20M=C3=A4ttig?= Date: Thu, 28 Dec 2017 16:31:56 +0100 Subject: [PATCH] Improve (weak and strict) type hints invarious places Change-Id: I3a42ec1547fae971d7b495c99dd144739d8521ab --- includes/OutputPage.php | 4 ++-- includes/Title.php | 2 +- includes/cache/CacheDependency.php | 1 - includes/content/Content.php | 4 ++-- includes/context/MutableContext.php | 4 ++-- includes/context/RequestContext.php | 10 +++------- includes/installer/DatabaseUpdater.php | 6 +++--- includes/search/SearchExactMatchRescorer.php | 4 ++-- includes/specials/pagers/ContribsPager.php | 2 +- 9 files changed, 16 insertions(+), 21 deletions(-) diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 1c2c29dca3..a2d445fe75 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -366,8 +366,8 @@ class OutputPage extends ContextSource { * Add a new "" 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 ] ); diff --git a/includes/Title.php b/includes/Title.php index b23bd5a364..3de85e1bf6 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -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 ) { diff --git a/includes/cache/CacheDependency.php b/includes/cache/CacheDependency.php index a59ba97d0a..dd4c49e7b3 100644 --- a/includes/cache/CacheDependency.php +++ b/includes/cache/CacheDependency.php @@ -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. diff --git a/includes/content/Content.php b/includes/content/Content.php index 6a0a63bfbd..3e5878281f 100644 --- a/includes/content/Content.php +++ b/includes/content/Content.php @@ -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, diff --git a/includes/context/MutableContext.php b/includes/context/MutableContext.php index 6358f11ce4..189b346c98 100644 --- a/includes/context/MutableContext.php +++ b/includes/context/MutableContext.php @@ -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 diff --git a/includes/context/RequestContext.php b/includes/context/RequestContext.php index c2d0de1dc9..cf5c939994 100644 --- a/includes/context/RequestContext.php +++ b/includes/context/RequestContext.php @@ -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() { diff --git a/includes/installer/DatabaseUpdater.php b/includes/installer/DatabaseUpdater.php index 54ff712030..242f148818 100644 --- a/includes/installer/DatabaseUpdater.php +++ b/includes/installer/DatabaseUpdater.php @@ -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(); diff --git a/includes/search/SearchExactMatchRescorer.php b/includes/search/SearchExactMatchRescorer.php index 0e99ba91ff..2687c8ec77 100644 --- a/includes/search/SearchExactMatchRescorer.php +++ b/includes/search/SearchExactMatchRescorer.php @@ -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; diff --git a/includes/specials/pagers/ContribsPager.php b/includes/specials/pagers/ContribsPager.php index 85faddc2e3..c3fa2b154f 100644 --- a/includes/specials/pagers/ContribsPager.php +++ b/includes/specials/pagers/ContribsPager.php @@ -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'] : ''; -- 2.20.1