Fix PHPDoc type hints in CacheTime, ParserOptions, and related

I'm intentionally not touching any code in this patch, only
documentation.

Change-Id: I6975194c218760031789d5335dfbb330017dc6fc
This commit is contained in:
Thiemo Kreuz 2018-04-18 14:31:13 +02:00 committed by Thiemo Kreuz (WMDE)
parent 4660ce079c
commit e6b6920cff
5 changed files with 28 additions and 20 deletions

View file

@ -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

View file

@ -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;

View file

@ -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();

View file

@ -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
*/

View file

@ -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 ) ) {