Fix PHPDoc type hints in CacheTime, ParserOptions, and related
authorThiemo Kreuz <thiemo.kreuz@wikimedia.de>
Wed, 18 Apr 2018 12:31:13 +0000 (14:31 +0200)
committerThiemo Kreuz (WMDE) <thiemo.kreuz@wikimedia.de>
Wed, 18 Apr 2018 15:10:31 +0000 (15:10 +0000)
I'm intentionally not touching any code in this patch, only
documentation.

Change-Id: I6975194c218760031789d5335dfbb330017dc6fc

includes/installer/DatabaseUpdater.php
includes/parser/CacheTime.php
includes/parser/ParserCache.php
includes/parser/ParserOptions.php
includes/parser/ParserOutput.php

index 04132ad..ecd3081 100644 (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
index 05bcebe..26d5bdd 100644 (file)
  * @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;
index 8a7fca6..e6326e6 100644 (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();
index ff21ef0..8fb9857 100644 (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
         */
index 8f0a1d7..f3a83db 100644 (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 ) ) {