From e6b6920cff7003b7aa3ed84bc1a3fc0861c9f022 Mon Sep 17 00:00:00 2001 From: Thiemo Kreuz Date: Wed, 18 Apr 2018 14:31:13 +0200 Subject: [PATCH] Fix PHPDoc type hints in CacheTime, ParserOptions, and related I'm intentionally not touching any code in this patch, only documentation. Change-Id: I6975194c218760031789d5335dfbb330017dc6fc --- includes/installer/DatabaseUpdater.php | 2 +- includes/parser/CacheTime.php | 26 ++++++++++++++++++-------- includes/parser/ParserCache.php | 4 ++-- includes/parser/ParserOptions.php | 4 ++-- includes/parser/ParserOutput.php | 12 +++++------- 5 files changed, 28 insertions(+), 20 deletions(-) diff --git a/includes/installer/DatabaseUpdater.php b/includes/installer/DatabaseUpdater.php index 04132ad577..ecd30819c3 100644 --- a/includes/installer/DatabaseUpdater.php +++ b/includes/installer/DatabaseUpdater.php @@ -136,7 +136,7 @@ abstract class DatabaseUpdater { $wgExtPGAlteredFields, $wgExtNewIndexes, $wgExtModifiedFields; # For extensions only, should be populated via hooks - # $wgDBtype should be checked to specifiy the proper file + # $wgDBtype should be checked to specify the proper file $wgExtNewTables = []; // table, dir $wgExtNewFields = []; // table, column, dir $wgExtPGNewFields = []; // table, column, column attributes; for PostgreSQL diff --git a/includes/parser/CacheTime.php b/includes/parser/CacheTime.php index 05bcebef64..26d5bdd3f9 100644 --- a/includes/parser/CacheTime.php +++ b/includes/parser/CacheTime.php @@ -27,21 +27,31 @@ * @ingroup Parser */ class CacheTime { - /** @var array|bool ParserOptions which have been taken into account to - * produce output or false if not available. + /** + * @var string[] ParserOptions which have been taken into account to produce output. */ public $mUsedOptions; - # Compatibility check + /** + * @var string|null Compatibility check + */ public $mVersion = Parser::VERSION; - # Time when this object was generated, or -1 for uncacheable. Used in ParserCache. + /** + * @var string|int TS_MW timestamp when this object was generated, or -1 for uncacheable. Used + * in ParserCache. + */ public $mCacheTime = ''; - # Seconds after which the object should expire, use 0 for uncacheable. Used in ParserCache. + /** + * @var int|null Seconds after which the object should expire, use 0 for uncacheable. Used in + * ParserCache. + */ public $mCacheExpiry = null; - # Revision ID that was parsed + /** + * @var int|null Revision ID that was parsed + */ public $mCacheRevisionId = null; /** @@ -71,7 +81,7 @@ class CacheTime { /** * @since 1.23 - * @param int $id Revision id + * @param int|null $id Revision ID */ public function setCacheRevisionId( $id ) { $this->mCacheRevisionId = $id; @@ -105,7 +115,7 @@ class CacheTime { * The value returned by getCacheExpiry is smaller or equal to the smallest number * that was provided to a call of updateCacheExpiry(), and smaller or equal to the * value of $wgParserCacheExpireTime. - * @return int|mixed|null + * @return int */ public function getCacheExpiry() { global $wgParserCacheExpireTime; diff --git a/includes/parser/ParserCache.php b/includes/parser/ParserCache.php index 8a7fca6c29..e6326e6c69 100644 --- a/includes/parser/ParserCache.php +++ b/includes/parser/ParserCache.php @@ -291,8 +291,8 @@ class ParserCache { * @param ParserOutput $parserOutput * @param WikiPage $page * @param ParserOptions $popts - * @param string $cacheTime Time when the cache was generated - * @param int $revId Revision ID that was parsed + * @param string|null $cacheTime TS_MW timestamp when the cache was generated + * @param int|null $revId Revision ID that was parsed */ public function save( $parserOutput, $page, $popts, $cacheTime = null, $revId = null ) { $expire = $parserOutput->getCacheExpiry(); diff --git a/includes/parser/ParserOptions.php b/includes/parser/ParserOptions.php index ff21ef0239..8fb98579f2 100644 --- a/includes/parser/ParserOptions.php +++ b/includes/parser/ParserOptions.php @@ -1211,7 +1211,7 @@ class ParserOptions { * in 1.16. * Used to get the old parser cache entries when available. * @deprecated since 1.30. You probably want self::allCacheVaryingOptions() instead. - * @return array + * @return string[] */ public static function legacyOptions() { wfDeprecated( __METHOD__, '1.30' ); @@ -1268,7 +1268,7 @@ class ParserOptions { * the same cached data safely. * * @since 1.17 - * @param array $forOptions + * @param string[] $forOptions * @param Title $title Used to get the content language of the page (since r97636) * @return string Page rendering hash */ diff --git a/includes/parser/ParserOutput.php b/includes/parser/ParserOutput.php index 8f0a1d7cc9..f3a83dbe89 100644 --- a/includes/parser/ParserOutput.php +++ b/includes/parser/ParserOutput.php @@ -177,7 +177,7 @@ class ParserOutput extends CacheTime { private $mIndexPolicy = ''; /** - * @var array $mAccessedOptions List of ParserOptions (stored in the keys). + * @var true[] $mAccessedOptions List of ParserOptions (stored in the keys). */ private $mAccessedOptions = []; @@ -685,9 +685,8 @@ class ParserOutput extends CacheTime { /** * Register a file dependency for this output * @param string $name Title dbKey - * @param string $timestamp MW timestamp of file creation (or false if non-existing) - * @param string $sha1 Base 36 SHA-1 of file (or false if non-existing) - * @return void + * @param string|false|null $timestamp MW timestamp of file creation (or false if non-existing) + * @param string|false|null $sha1 Base 36 SHA-1 of file (or false if non-existing) */ public function addImage( $name, $timestamp = null, $sha1 = null ) { $this->mImages[$name] = 1; @@ -701,7 +700,6 @@ class ParserOutput extends CacheTime { * @param Title $title * @param int $page_id * @param int $rev_id - * @return void */ public function addTemplate( $title, $page_id, $rev_id ) { $ns = $title->getNamespace(); @@ -968,8 +966,8 @@ class ParserOutput extends CacheTime { /** * Returns the options from its ParserOptions which have been taken - * into account to produce this output or false if not available. - * @return array + * into account to produce this output. + * @return string[] */ public function getUsedOptions() { if ( !isset( $this->mAccessedOptions ) ) { -- 2.20.1