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 /lib/private/Files | |
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 'lib/private/Files')
-rw-r--r-- | lib/private/Files/AppData/AppData.php | 21 | ||||
-rw-r--r-- | lib/private/Files/Config/UserMountCache.php | 27 |
2 files changed, 13 insertions, 35 deletions
diff --git a/lib/private/Files/AppData/AppData.php b/lib/private/Files/AppData/AppData.php index 53f69be7127..471de799c2f 100644 --- a/lib/private/Files/AppData/AppData.php +++ b/lib/private/Files/AppData/AppData.php @@ -38,21 +38,12 @@ use OCP\Files\NotPermittedException; use OCP\Files\SimpleFS\ISimpleFolder; class AppData implements IAppData { - - /** @var IRootFolder */ - private $rootFolder; - - /** @var SystemConfig */ - private $config; - - /** @var string */ - private $appId; - - /** @var Folder */ - private $folder; - - /** @var (ISimpleFolder|NotFoundException)[]|CappedMemoryCache */ - private $folders; + private IRootFolder $rootFolder; + private SystemConfig $config; + private string $appId; + private ?Folder $folder = null; + /** @var CappedMemoryCache<ISimpleFolder|NotFoundException> */ + private CappedMemoryCache $folders; /** * AppData constructor. diff --git a/lib/private/Files/Config/UserMountCache.php b/lib/private/Files/Config/UserMountCache.php index a5fe04c2cac..c326eeb0b6c 100644 --- a/lib/private/Files/Config/UserMountCache.php +++ b/lib/private/Files/Config/UserMountCache.php @@ -36,7 +36,6 @@ use OCP\Files\Config\ICachedMountInfo; use OCP\Files\Config\IUserMountCache; use OCP\Files\Mount\IMountPoint; use OCP\Files\NotFoundException; -use OCP\ICache; use OCP\IDBConnection; use OCP\IUser; use OCP\IUserManager; @@ -46,30 +45,17 @@ use Psr\Log\LoggerInterface; * Cache mounts points per user in the cache so we can easilly look them up */ class UserMountCache implements IUserMountCache { - /** - * @var IDBConnection - */ - private $connection; - - /** - * @var IUserManager - */ - private $userManager; + private IDBConnection $connection; + private IUserManager $userManager; /** * Cached mount info. - * Map of $userId to ICachedMountInfo. - * - * @var ICache + * @var CappedMemoryCache<ICachedMountInfo[]> **/ - private $mountsForUsers; - + private CappedMemoryCache $mountsForUsers; private LoggerInterface $logger; - - /** - * @var ICache - */ - private $cacheInfoCache; + /** @var CappedMemoryCache<array> */ + private CappedMemoryCache $cacheInfoCache; /** * UserMountCache constructor. @@ -132,6 +118,7 @@ class UserMountCache implements IUserMountCache { foreach ($addedMounts as $mount) { $this->addToCache($mount); + /** @psalm-suppress InvalidArgument */ $this->mountsForUsers[$user->getUID()][] = $mount; } foreach ($removedMounts as $mount) { |