diff options
author | Carl Schwan <carl@carlschwan.eu> | 2022-05-03 11:15:24 +0200 |
---|---|---|
committer | Carl Schwan <carl@carlschwan.eu> | 2022-05-12 15:06:18 +0200 |
commit | ec6b83cc1891214c7fa3a236626807b4335f9a2f (patch) | |
tree | b5f12993172528ddec15b7b8ae6a09a0080fedd7 /apps/files_external/lib/Lib/Storage/AmazonS3.php | |
parent | 5a0b28d603e142051967175f023b698ff7e262db (diff) | |
download | nextcloud-server-ec6b83cc1891214c7fa3a236626807b4335f9a2f.tar.gz nextcloud-server-ec6b83cc1891214c7fa3a236626807b4335f9a2f.zip |
Add stricter psalm type for CappedMemoryCache
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Diffstat (limited to 'apps/files_external/lib/Lib/Storage/AmazonS3.php')
-rw-r--r-- | apps/files_external/lib/Lib/Storage/AmazonS3.php | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/apps/files_external/lib/Lib/Storage/AmazonS3.php b/apps/files_external/lib/Lib/Storage/AmazonS3.php index d3e9605e5a1..e7a8c5f9329 100644 --- a/apps/files_external/lib/Lib/Storage/AmazonS3.php +++ b/apps/files_external/lib/Lib/Storage/AmazonS3.php @@ -54,6 +54,7 @@ use OCP\Files\IMimeTypeDetector; use OCP\ICacheFactory; use OCP\IMemcache; use OCP\Server; +use OCP\ICache; class AmazonS3 extends \OC\Files\Storage\Common { use S3ConnectionTrait; @@ -63,23 +64,18 @@ class AmazonS3 extends \OC\Files\Storage\Common { return false; } - /** @var CappedMemoryCache|Result[] */ - private $objectCache; + /** @var CappedMemoryCache<array|false> */ + private CappedMemoryCache $objectCache; - /** @var CappedMemoryCache|bool[] */ - private $directoryCache; + /** @var CappedMemoryCache<bool> */ + private CappedMemoryCache $directoryCache; - /** @var CappedMemoryCache|array */ - private $filesCache; + /** @var CappedMemoryCache<array> */ + private CappedMemoryCache $filesCache; - /** @var IMimeTypeDetector */ - private $mimeDetector; - - /** @var bool|null */ - private $versioningEnabled = null; - - /** @var IMemcache */ - private $memCache; + private IMimeTypeDetector $mimeDetector; + private ?bool $versioningEnabled = null; + private ICache $memCache; public function __construct($parameters) { parent::__construct($parameters); @@ -146,10 +142,9 @@ class AmazonS3 extends \OC\Files\Storage\Common { } /** - * @param $key * @return array|false */ - private function headObject($key) { + private function headObject(string $key) { if (!isset($this->objectCache[$key])) { try { $this->objectCache[$key] = $this->getConnection()->headObject([ @@ -165,6 +160,7 @@ class AmazonS3 extends \OC\Files\Storage\Common { } if (is_array($this->objectCache[$key]) && !isset($this->objectCache[$key]["Key"])) { + /** @psalm-suppress InvalidArgument Psalm doesn't understand nested arrays well */ $this->objectCache[$key]["Key"] = $key; } return $this->objectCache[$key]; |