Thiemo Kreuz (WMDE) (Code Review)
2017-12-28 15:32:32 UTC
Thiemo Kreuz (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/400587 )
Change subject: Improve (weak and strict) type hints invarious places
......................................................................
Improve (weak and strict) type hints invarious places
Change-Id: I3a42ec1547fae971d7b495c99dd144739d8521ab
---
M includes/OutputPage.php
M includes/Title.php
M includes/cache/CacheDependency.php
M includes/content/Content.php
M includes/context/MutableContext.php
M includes/context/RequestContext.php
M includes/installer/DatabaseUpdater.php
M includes/search/SearchExactMatchRescorer.php
M includes/specials/pagers/ContribsPager.php
9 files changed, 16 insertions(+), 21 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/87/400587/1
diff --git a/includes/OutputPage.php b/includes/OutputPage.php
index 1c2c29d..a2d445f 100644
--- a/includes/OutputPage.php
+++ b/includes/OutputPage.php
@@ -366,8 +366,8 @@
* 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 ] );
diff --git a/includes/Title.php b/includes/Title.php
index b23bd5a..3de85e1 100644
--- a/includes/Title.php
+++ b/includes/Title.php
@@ -4644,7 +4644,7 @@
/**
* 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 a59ba97..dd4c49e 100644
--- a/includes/cache/CacheDependency.php
+++ b/includes/cache/CacheDependency.php
@@ -34,7 +34,6 @@
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 6a0a63b..3e58782 100644
--- a/includes/content/Content.php
+++ b/includes/content/Content.php
@@ -483,11 +483,11 @@
* @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 6358f11..189b346 100644
--- a/includes/context/MutableContext.php
+++ b/includes/context/MutableContext.php
@@ -26,9 +26,9 @@
/**
* 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 c2d0de1..cf5c939 100644
--- a/includes/context/RequestContext.php
+++ b/includes/context/RequestContext.php
@@ -81,17 +81,13 @@
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 54ff712..242f148 100644
--- a/includes/installer/DatabaseUpdater.php
+++ b/includes/installer/DatabaseUpdater.php
@@ -179,12 +179,12 @@
/**
* @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 @@
* 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 0e99ba9..2687c8e 100644
--- a/includes/search/SearchExactMatchRescorer.php
+++ b/includes/search/SearchExactMatchRescorer.php
@@ -100,7 +100,7 @@
* @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 @@
* @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 85faddc..c3fa2b1 100644
--- a/includes/specials/pagers/ContribsPager.php
+++ b/includes/specials/pagers/ContribsPager.php
@@ -634,7 +634,7 @@
* @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'] : '';
--
To view, visit https://gerrit.wikimedia.org/r/400587
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3a42ec1547fae971d7b495c99dd144739d8521ab
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Thiemo Kreuz (WMDE) <***@wikimedia.de>
Change subject: Improve (weak and strict) type hints invarious places
......................................................................
Improve (weak and strict) type hints invarious places
Change-Id: I3a42ec1547fae971d7b495c99dd144739d8521ab
---
M includes/OutputPage.php
M includes/Title.php
M includes/cache/CacheDependency.php
M includes/content/Content.php
M includes/context/MutableContext.php
M includes/context/RequestContext.php
M includes/installer/DatabaseUpdater.php
M includes/search/SearchExactMatchRescorer.php
M includes/specials/pagers/ContribsPager.php
9 files changed, 16 insertions(+), 21 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/87/400587/1
diff --git a/includes/OutputPage.php b/includes/OutputPage.php
index 1c2c29d..a2d445f 100644
--- a/includes/OutputPage.php
+++ b/includes/OutputPage.php
@@ -366,8 +366,8 @@
* 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 ] );
diff --git a/includes/Title.php b/includes/Title.php
index b23bd5a..3de85e1 100644
--- a/includes/Title.php
+++ b/includes/Title.php
@@ -4644,7 +4644,7 @@
/**
* 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 a59ba97..dd4c49e 100644
--- a/includes/cache/CacheDependency.php
+++ b/includes/cache/CacheDependency.php
@@ -34,7 +34,6 @@
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 6a0a63b..3e58782 100644
--- a/includes/content/Content.php
+++ b/includes/content/Content.php
@@ -483,11 +483,11 @@
* @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 6358f11..189b346 100644
--- a/includes/context/MutableContext.php
+++ b/includes/context/MutableContext.php
@@ -26,9 +26,9 @@
/**
* 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 c2d0de1..cf5c939 100644
--- a/includes/context/RequestContext.php
+++ b/includes/context/RequestContext.php
@@ -81,17 +81,13 @@
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 54ff712..242f148 100644
--- a/includes/installer/DatabaseUpdater.php
+++ b/includes/installer/DatabaseUpdater.php
@@ -179,12 +179,12 @@
/**
* @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 @@
* 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 0e99ba9..2687c8e 100644
--- a/includes/search/SearchExactMatchRescorer.php
+++ b/includes/search/SearchExactMatchRescorer.php
@@ -100,7 +100,7 @@
* @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 @@
* @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 85faddc..c3fa2b1 100644
--- a/includes/specials/pagers/ContribsPager.php
+++ b/includes/specials/pagers/ContribsPager.php
@@ -634,7 +634,7 @@
* @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'] : '';
--
To view, visit https://gerrit.wikimedia.org/r/400587
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3a42ec1547fae971d7b495c99dd144739d8521ab
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Thiemo Kreuz (WMDE) <***@wikimedia.de>