From 71e41ffeeb4367f3253f16aba3bf21b80c09ca2b Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Thu, 15 Jun 2023 23:21:56 +0200 Subject: refactor: declare getMount() and getMountsIn() at IRootFolder Signed-off-by: Arthur Schiwon --- lib/private/Files/Node/Folder.php | 8 ++------ lib/private/Files/Node/LazyFolder.php | 7 ++++--- lib/private/Files/Node/Root.php | 8 ++------ 3 files changed, 8 insertions(+), 15 deletions(-) (limited to 'lib/private/Files/Node') diff --git a/lib/private/Files/Node/Folder.php b/lib/private/Files/Node/Folder.php index 9714a0aea00..41bac26248b 100644 --- a/lib/private/Files/Node/Folder.php +++ b/lib/private/Files/Node/Folder.php @@ -330,12 +330,8 @@ class Folder extends Node implements \OCP\Files\Folder { * @return array */ protected function getByIdInRootMount(int $id): array { - $storage = null; - if (\method_exists($this->root, 'getMount')) { - /** @var IMountPoint $mount */ - $mount = $this->root->getMount(''); - $storage = $mount->getStorage(); - } + $mount = $this->root->getMount(''); + $storage = $mount->getStorage(); $cacheEntry = $storage?->getCache($this->path)->get($id); if (!$cacheEntry) { return []; diff --git a/lib/private/Files/Node/LazyFolder.php b/lib/private/Files/Node/LazyFolder.php index c843baabade..9f9528f69bd 100644 --- a/lib/private/Files/Node/LazyFolder.php +++ b/lib/private/Files/Node/LazyFolder.php @@ -29,6 +29,7 @@ namespace OC\Files\Node; use OC\Files\Utils\PathHelper; use OCP\Files\Folder; use OCP\Constants; +use OCP\Files\Mount\IMountPoint; /** * Class LazyFolder @@ -111,14 +112,14 @@ class LazyFolder implements Folder { /** * @inheritDoc */ - public function getMount($mountPoint) { + public function getMount(string $mountPoint): IMountPoint { return $this->__call(__FUNCTION__, func_get_args()); } /** - * @inheritDoc + * @return IMountPoint[] */ - public function getMountsIn($mountPoint) { + public function getMountsIn(string $mountPoint): array { return $this->__call(__FUNCTION__, func_get_args()); } diff --git a/lib/private/Files/Node/Root.php b/lib/private/Files/Node/Root.php index 0ed1bcab2ae..7bd88981ff2 100644 --- a/lib/private/Files/Node/Root.php +++ b/lib/private/Files/Node/Root.php @@ -154,11 +154,7 @@ class Root extends Folder implements IRootFolder { $this->mountManager->addMount($mount); } - /** - * @param string $mountPoint - * @return \OC\Files\Mount\MountPoint - */ - public function getMount($mountPoint) { + public function getMount(string $mountPoint): IMountPoint { return $this->mountManager->find($mountPoint); } @@ -166,7 +162,7 @@ class Root extends Folder implements IRootFolder { * @param string $mountPoint * @return \OC\Files\Mount\MountPoint[] */ - public function getMountsIn($mountPoint) { + public function getMountsIn(string $mountPoint): array { return $this->mountManager->findIn($mountPoint); } -- cgit v1.2.3