diff options
author | Robin Appelman <robin@icewind.nl> | 2022-02-10 14:15:07 +0100 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2022-03-04 16:28:11 +0100 |
commit | 7630d7a934c8e8036313824d95e5aa9de80dab96 (patch) | |
tree | 4fd8a8f406a17e9d0a48fb02fed84f88cbb01b18 /lib/private/Files/Config | |
parent | 69a6efba477685f0f0c66c06d06ae27675acbf96 (diff) | |
download | nextcloud-server-7630d7a934c8e8036313824d95e5aa9de80dab96.tar.gz nextcloud-server-7630d7a934c8e8036313824d95e5aa9de80dab96.zip |
more type hints for ICachedMountInfo and IMountManager
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/Files/Config')
-rw-r--r-- | lib/private/Files/Config/CachedMountFileInfo.php | 3 | ||||
-rw-r--r-- | lib/private/Files/Config/CachedMountInfo.php | 55 | ||||
-rw-r--r-- | lib/private/Files/Config/LazyStorageMountInfo.php | 16 |
3 files changed, 25 insertions, 49 deletions
diff --git a/lib/private/Files/Config/CachedMountFileInfo.php b/lib/private/Files/Config/CachedMountFileInfo.php index 71a6ddb9ea9..11a9a505808 100644 --- a/lib/private/Files/Config/CachedMountFileInfo.php +++ b/lib/private/Files/Config/CachedMountFileInfo.php @@ -27,8 +27,7 @@ use OCP\Files\Config\ICachedMountFileInfo; use OCP\IUser; class CachedMountFileInfo extends CachedMountInfo implements ICachedMountFileInfo { - /** @var string */ - private $internalPath; + private string $internalPath; public function __construct( IUser $user, diff --git a/lib/private/Files/Config/CachedMountInfo.php b/lib/private/Files/Config/CachedMountInfo.php index c70dba100a4..43c9fae63ec 100644 --- a/lib/private/Files/Config/CachedMountInfo.php +++ b/lib/private/Files/Config/CachedMountInfo.php @@ -28,38 +28,13 @@ use OCP\Files\Node; use OCP\IUser; class CachedMountInfo implements ICachedMountInfo { - /** - * @var IUser - */ - protected $user; - - /** - * @var int - */ - protected $storageId; - - /** - * @var int - */ - protected $rootId; - - /** - * @var string - */ - protected $mountPoint; - - /** - * @var int|null - */ - protected $mountId; - - /** - * @var string - */ - protected $rootInternalPath; - - /** @var string */ - protected $mountProvider; + protected IUser $user; + protected int $storageId; + protected int $rootId; + protected string $mountPoint; + protected ?int $mountId; + protected string $rootInternalPath; + protected string $mountProvider; /** * CachedMountInfo constructor. @@ -95,28 +70,28 @@ class CachedMountInfo implements ICachedMountInfo { /** * @return IUser */ - public function getUser() { + public function getUser(): IUser { return $this->user; } /** * @return int the numeric storage id of the mount */ - public function getStorageId() { + public function getStorageId(): int { return $this->storageId; } /** * @return int the fileid of the root of the mount */ - public function getRootId() { + public function getRootId(): int { return $this->rootId; } /** - * @return Node the root node of the mount + * @return Node|null the root node of the mount */ - public function getMountPointNode() { + public function getMountPointNode(): ?Node { // TODO injection etc Filesystem::initMountPoints($this->getUser()->getUID()); $userNode = \OC::$server->getUserFolder($this->getUser()->getUID()); @@ -131,7 +106,7 @@ class CachedMountInfo implements ICachedMountInfo { /** * @return string the mount point of the mount for the user */ - public function getMountPoint() { + public function getMountPoint(): string { return $this->mountPoint; } @@ -141,7 +116,7 @@ class CachedMountInfo implements ICachedMountInfo { * @return int|null mount id or null if not applicable * @since 9.1.0 */ - public function getMountId() { + public function getMountId(): ?int { return $this->mountId; } @@ -150,7 +125,7 @@ class CachedMountInfo implements ICachedMountInfo { * * @return string */ - public function getRootInternalPath() { + public function getRootInternalPath(): string { return $this->rootInternalPath; } diff --git a/lib/private/Files/Config/LazyStorageMountInfo.php b/lib/private/Files/Config/LazyStorageMountInfo.php index fd3bbcbe0fb..78055a2cdb8 100644 --- a/lib/private/Files/Config/LazyStorageMountInfo.php +++ b/lib/private/Files/Config/LazyStorageMountInfo.php @@ -25,8 +25,7 @@ use OCP\Files\Mount\IMountPoint; use OCP\IUser; class LazyStorageMountInfo extends CachedMountInfo { - /** @var IMountPoint */ - private $mount; + private IMountPoint $mount; /** * CachedMountInfo constructor. @@ -37,12 +36,15 @@ class LazyStorageMountInfo extends CachedMountInfo { public function __construct(IUser $user, IMountPoint $mount) { $this->user = $user; $this->mount = $mount; + $this->rootId = 0; + $this->storageId = 0; + $this->mountPoint = ''; } /** * @return int the numeric storage id of the mount */ - public function getStorageId() { + public function getStorageId(): int { if (!$this->storageId) { $this->storageId = $this->mount->getNumericStorageId(); } @@ -52,7 +54,7 @@ class LazyStorageMountInfo extends CachedMountInfo { /** * @return int the fileid of the root of the mount */ - public function getRootId() { + public function getRootId(): int { if (!$this->rootId) { $this->rootId = $this->mount->getStorageRootId(); } @@ -62,14 +64,14 @@ class LazyStorageMountInfo extends CachedMountInfo { /** * @return string the mount point of the mount for the user */ - public function getMountPoint() { + public function getMountPoint(): string { if (!$this->mountPoint) { $this->mountPoint = $this->mount->getMountPoint(); } return parent::getMountPoint(); } - public function getMountId() { + public function getMountId(): ?int { return $this->mount->getMountId(); } @@ -78,7 +80,7 @@ class LazyStorageMountInfo extends CachedMountInfo { * * @return string */ - public function getRootInternalPath() { + public function getRootInternalPath(): string { return $this->mount->getInternalPath($this->mount->getMountPoint()); } |