Unsuppress phan issues part 6
[lhc/web/wiklou.git] / includes / libs / objectcache / wancache / WANObjectCache.php
index 1852685..2ce216d 100644 (file)
@@ -506,6 +506,7 @@ class WANObjectCache implements IExpiringStore, IStoreKeyEncoder, LoggerAwareInt
                        }
                        $purgeValues[] = $purge;
                }
+
                return $purgeValues;
        }
 
@@ -577,10 +578,14 @@ class WANObjectCache implements IExpiringStore, IStoreKeyEncoder, LoggerAwareInt
         *   - version: Integer version number signifiying the format of the value.
         *      Default: null
         *   - walltime: How long the value took to generate in seconds. Default: 0.0
+        * @codingStandardsIgnoreStart
+        * @phan-param array{lag?:int,since?:int,pending?:bool,lockTSE?:int,staleTTL?:int,creating?:bool,version?:?string,walltime?:int|float} $opts
+        * @codingStandardsIgnoreEnd
         * @note Options added in 1.28: staleTTL
         * @note Options added in 1.33: creating
         * @note Options added in 1.34: version, walltime
         * @return bool Success
+        * @suppress PhanTypeInvalidDimOffset
         */
        final public function set( $key, $value, $ttl = self::TTL_INDEFINITE, array $opts = [] ) {
                $now = $this->getCurrentTime();
@@ -1245,11 +1250,15 @@ class WANObjectCache implements IExpiringStore, IStoreKeyEncoder, LoggerAwareInt
         *      most sense for values that are moderately to highly expensive to regenerate and easy
         *      to query for dependency timestamps. The use of "pcTTL" reduces timestamp queries.
         *      Default: null.
+        * @codingStandardsIgnoreStart
+        * @phan-param array{checkKeys?:string[],graceTTL?:int,lockTSE?:int,busyValue?:mixed,pcTTL?:int,pcGroup?:string,version?:int,minAsOf?:int,hotTTR?:int,lowTTL?:int,ageNew?:int,staleTTL?:int,touchedCallback?:callable} $opts
+        * @codingStandardsIgnoreEnd
         * @return mixed Value found or written to the key
         * @note Options added in 1.28: version, busyValue, hotTTR, ageNew, pcGroup, minAsOf
         * @note Options added in 1.31: staleTTL, graceTTL
         * @note Options added in 1.33: touchedCallback
         * @note Callable type hints are not used to avoid class-autoloading
+        * @suppress PhanTypeInvalidDimOffset
         */
        final public function getWithSetCallback( $key, $ttl, $callback, array $opts = [] ) {
                $version = $opts['version'] ?? null;
@@ -1304,6 +1313,7 @@ class WANObjectCache implements IExpiringStore, IStoreKeyEncoder, LoggerAwareInt
         *   - Cached or regenerated value version number or null if not versioned
         *   - Timestamp of the current cached value at the key or null if there is no value
         * @note Callable type hints are not used to avoid class-autoloading
+        * @suppress PhanTypeArraySuspicious
         */
        private function fetchOrRegenerate( $key, $ttl, $callback, array $opts ) {
                $checkKeys = $opts['checkKeys'] ?? [];
@@ -1440,6 +1450,7 @@ class WANObjectCache implements IExpiringStore, IStoreKeyEncoder, LoggerAwareInt
                                $this->setInterimValue( $key, $value, $lockTSE, $version, $walltime );
                        } else {
                                $finalSetOpts = [
+                                       // @phan-suppress-next-line PhanTypeInvalidDimOffset
                                        'since' => $setOpts['since'] ?? $preCallbackTime,
                                        'version' => $version,
                                        'staleTTL' => $staleTTL,
@@ -2207,14 +2218,14 @@ class WANObjectCache implements IExpiringStore, IStoreKeyEncoder, LoggerAwareInt
                        // Wildcards select all matching routes, e.g. the WAN cluster on all DCs
                        $ok = $this->cache->set(
                                "/*/{$this->cluster}/{$key}",
-                               $this->makePurgeValue( $this->getCurrentTime(), self::HOLDOFF_TTL_NONE ),
+                               $this->makePurgeValue( $this->getCurrentTime(), $holdoff ),
                                $ttl
                        );
                } else {
-                       // This handles the mcrouter and the single-DC case
+                       // Some other proxy handles broadcasting or there is only one datacenter
                        $ok = $this->cache->set(
                                $key,
-                               $this->makePurgeValue( $this->getCurrentTime(), self::HOLDOFF_TTL_NONE ),
+                               $this->makePurgeValue( $this->getCurrentTime(), $holdoff ),
                                $ttl
                        );
                }
@@ -2420,6 +2431,7 @@ class WANObjectCache implements IExpiringStore, IStoreKeyEncoder, LoggerAwareInt
         *   - curTTL: remaining time-to-live (negative if tombstoned) or null if there is no value
         *   - version: value version number or null if the if there is no value
         *   - tombAsOf: UNIX timestamp of the tombstone or null if there is no tombstone
+        * @phan-return array{0:mixed,1:array{asOf:?mixed,curTTL:?int|float,version:?mixed,tombAsOf:?mixed}}
         */
        private function unwrap( $wrapped, $now ) {
                $value = false;