diff options
author | Aaron Schulz <aschulz@wikimedia.org> | 2025-01-30 12:57:45 -0800 |
---|---|---|
committer | Derick Alangi <alangiderick@gmail.com> | 2025-04-04 13:28:00 +0100 |
commit | f04200dab7b293ba01053fc20cedb13fce37c7c5 (patch) | |
tree | 7d3781391fe47fc8908e171a9c49c1e0757e912c | |
parent | 1448b92b5002a756694b8990f53c4f9a182b1a84 (diff) | |
download | mediawikicore-f04200dab7b293ba01053fc20cedb13fce37c7c5.tar.gz mediawikicore-f04200dab7b293ba01053fc20cedb13fce37c7c5.zip |
objectcache: suppress various PhpUnusedLocalVariableInspection warnings in WANObjectCache
Change-Id: I9977d80bbbff215b18c9f099f0bef0865a3d1ac5
-rw-r--r-- | RELEASE-NOTES-1.44 | 2 | ||||
-rw-r--r-- | includes/libs/objectcache/BagOStuff.php | 11 | ||||
-rw-r--r-- | includes/libs/objectcache/WANObjectCache.php | 14 |
3 files changed, 15 insertions, 12 deletions
diff --git a/RELEASE-NOTES-1.44 b/RELEASE-NOTES-1.44 index d733acf0d2da..8c3f7e05a30a 100644 --- a/RELEASE-NOTES-1.44 +++ b/RELEASE-NOTES-1.44 @@ -271,6 +271,8 @@ because of Phabricator reports. been removed. * The `MediaWiki\User\Registration\IUserRegistrationProvider` interface now defines a required fetchRegistrationBatch() method. +* BagOStuff::clearLastError() and WANObjectCache::clearLastError(), both + deprecated in 1.43, have been removed. * The hook OutputPageMakeCategoryLinks, deprecated in 1.43, has been removed. * ApiPageSet::getTitles(), ApiPageSet::getGoodTitles(), ApiPageSet::getMissingTitles(), ApiPageSet::getGoodAndMissingTitles(), diff --git a/includes/libs/objectcache/BagOStuff.php b/includes/libs/objectcache/BagOStuff.php index 5edb35bbdd9f..5e73704c6088 100644 --- a/includes/libs/objectcache/BagOStuff.php +++ b/includes/libs/objectcache/BagOStuff.php @@ -557,17 +557,6 @@ abstract class BagOStuff implements } /** - * Clear the "last error" registry - * - * @since 1.23 - * @deprecated Since 1.38, hard deprecated in 1.43 - */ - public function clearLastError() { - wfDeprecated( __METHOD__, '1.38' ); - $this->lastError = self::ERR_NONE; - } - - /** * Set the "last error" registry due to a problem encountered during an attempted operation * * @param int $error BagOStuff:ERR_* constant diff --git a/includes/libs/objectcache/WANObjectCache.php b/includes/libs/objectcache/WANObjectCache.php index 925a2709158d..d2661d68bd7a 100644 --- a/includes/libs/objectcache/WANObjectCache.php +++ b/includes/libs/objectcache/WANObjectCache.php @@ -194,7 +194,7 @@ class WANObjectCache implements protected $coalesceScheme; /** @var TracerInterface */ - private $tracer = null; + private $tracer; /** @var array<int,array> List of (key, UNIX timestamp) tuples for get() cache misses */ private $missLog; @@ -461,6 +461,7 @@ class WANObjectCache implements // Also, if no $info parameter is provided, then it doesn't matter how it changes here. $legacyInfo = ( $info !== self::PASS_BY_REF ); + /** @noinspection PhpUnusedLocalVariableInspection */ $span = $this->startOperationSpan( __FUNCTION__, $key, $checkKeys ); $now = $this->getCurrentTime(); @@ -521,6 +522,7 @@ class WANObjectCache implements // Also, if no $info parameter is provided, then it doesn't matter how it changes here. $legacyInfo = ( $info !== self::PASS_BY_REF ); + /** @noinspection PhpUnusedLocalVariableInspection */ $span = $this->startOperationSpan( __FUNCTION__, $keys, $checkKeys ); $curTTLs = []; @@ -803,6 +805,7 @@ class WANObjectCache implements * @return bool Success */ final public function set( $key, $value, $ttl = self::TTL_INDEFINITE, array $opts = [] ) { + /** @noinspection PhpUnusedLocalVariableInspection */ $span = $this->startOperationSpan( __FUNCTION__, $key ); $keygroup = $this->determineKeyGroupForStats( $key ); @@ -1055,6 +1058,7 @@ class WANObjectCache implements * @return bool True if the item was purged or not found, false on failure */ final public function delete( $key, $ttl = self::HOLDOFF_TTL ) { + /** @noinspection PhpUnusedLocalVariableInspection */ $span = $this->startOperationSpan( __FUNCTION__, $key ); // Purge values must be stored under the value key so that WANObjectCache::set() @@ -1116,7 +1120,9 @@ class WANObjectCache implements * @return float UNIX timestamp */ final public function getCheckKeyTime( $key ) { + /** @noinspection PhpUnusedLocalVariableInspection */ $span = $this->startOperationSpan( __FUNCTION__, $key ); + return $this->getMultiCheckKeyTime( [ $key ] )[$key]; } @@ -1182,6 +1188,7 @@ class WANObjectCache implements * @since 1.31 */ final public function getMultiCheckKeyTime( array $keys ) { + /** @noinspection PhpUnusedLocalVariableInspection */ $span = $this->startOperationSpan( __FUNCTION__, $keys ); $checkSisterKeysByKey = []; @@ -1246,6 +1253,7 @@ class WANObjectCache implements * @return bool True if the item was purged or not found, false on failure */ public function touchCheckKey( $key, $holdoff = self::HOLDOFF_TTL ) { + /** @noinspection PhpUnusedLocalVariableInspection */ $span = $this->startOperationSpan( __FUNCTION__, $key ); $checkSisterKey = $this->makeSisterKey( $key, self::TYPE_TIMESTAMP ); @@ -1298,6 +1306,7 @@ class WANObjectCache implements * @return bool True if the item was purged or not found, false on failure */ public function resetCheckKey( $key ) { + /** @noinspection PhpUnusedLocalVariableInspection */ $span = $this->startOperationSpan( __FUNCTION__, $key ); $checkSisterKey = $this->makeSisterKey( $key, self::TYPE_TIMESTAMP ); @@ -1618,7 +1627,9 @@ class WANObjectCache implements final public function getWithSetCallback( $key, $ttl, $callback, array $opts = [], array $cbParams = [] ) { + /** @noinspection PhpUnusedLocalVariableInspection */ $span = $this->startOperationSpan( __FUNCTION__, $key ); + $version = $opts['version'] ?? null; $pcTTL = $opts['pcTTL'] ?? self::TTL_UNCACHEABLE; $pCache = ( $pcTTL >= 0 ) @@ -1828,6 +1839,7 @@ class WANObjectCache implements $preCallbackTime = $this->getCurrentTime(); ++$this->callbackDepth; // https://github.com/phan/phan/issues/4419 + /** @noinspection PhpUnusedLocalVariableInspection */ $value = null; try { $value = $callback( |