Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2022-02-10 16:15:07 +0300
committerRobin Appelman <robin@icewind.nl>2022-03-04 18:28:11 +0300
commit7630d7a934c8e8036313824d95e5aa9de80dab96 (patch)
tree4fd8a8f406a17e9d0a48fb02fed84f88cbb01b18 /lib/private/Files
parent69a6efba477685f0f0c66c06d06ae27675acbf96 (diff)
more type hints for ICachedMountInfo and IMountManager
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/Files')
-rw-r--r--lib/private/Files/Config/CachedMountFileInfo.php3
-rw-r--r--lib/private/Files/Config/CachedMountInfo.php55
-rw-r--r--lib/private/Files/Config/LazyStorageMountInfo.php16
-rw-r--r--lib/private/Files/Mount/Manager.php12
4 files changed, 29 insertions, 57 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());
}
diff --git a/lib/private/Files/Mount/Manager.php b/lib/private/Files/Mount/Manager.php
index 22b05b1f384..cfb008a94d1 100644
--- a/lib/private/Files/Mount/Manager.php
+++ b/lib/private/Files/Mount/Manager.php
@@ -35,13 +35,9 @@ use OCP\Files\Mount\IMountPoint;
class Manager implements IMountManager {
/** @var MountPoint[] */
- private $mounts = [];
-
- /** @var CappedMemoryCache */
- private $pathCache;
-
- /** @var CappedMemoryCache */
- private $inPathCache;
+ private array $mounts = [];
+ private CappedMemoryCache $pathCache;
+ private CappedMemoryCache $inPathCache;
public function __construct() {
$this->pathCache = new CappedMemoryCache();
@@ -99,7 +95,7 @@ class Manager implements IMountManager {
* @param string $path
* @return MountPoint|null
*/
- public function find(string $path) {
+ public function find(string $path): ?MountPoint {
$this->setupForFind($path);
$path = Filesystem::normalizePath($path);