diff --git a/lib/private/Files/Node/Folder.php b/lib/private/Files/Node/Folder.php index b376d4673e411..5669f2a4b4599 100644 --- a/lib/private/Files/Node/Folder.php +++ b/lib/private/Files/Node/Folder.php @@ -109,7 +109,7 @@ public function getDirectoryListing() { }, $folderContent); } - protected function createNode(string $path, ?FileInfo $info = null, bool $infoHasSubMountsIncluded = true): INode { + protected function createNode(string $path, ?FileInfo $info = null): INode { if (is_null($info)) { $isDir = $this->view->is_dir($path); } else { @@ -326,7 +326,7 @@ protected function getAppDataDirectoryName(): string { * @param int $id * @return array */ - protected function getByIdInRootMount(int $id): array { + protected function getByIdInRootMount(int $id): array { if (!method_exists($this->root, 'createNode')) { // Always expected to be false. Being a method of Folder, this is // always implemented. For it is an internal method and should not @@ -335,7 +335,7 @@ protected function getByIdInRootMount(int $id): array { } $mount = $this->root->getMount(''); $storage = $mount->getStorage(); - $cacheEntry = $storage?->getCache($this->path)->get($id); + $cacheEntry = $storage ? $storage->getCache($this->path)->get($id) : null; if (!$cacheEntry) { return []; } diff --git a/lib/private/Files/Node/Node.php b/lib/private/Files/Node/Node.php index 7c8c019783407..5af317b2a498f 100644 --- a/lib/private/Files/Node/Node.php +++ b/lib/private/Files/Node/Node.php @@ -72,7 +72,7 @@ class Node implements INode { * @param string $path * @param FileInfo $fileInfo */ - public function __construct($root, $view, $path, $fileInfo = null, ?Node $parent = null) { + public function __construct(IRootFolder $root, $view, $path, $fileInfo = null, ?Node $parent = null) { if (Filesystem::normalizePath($view->getRoot()) !== '/') { throw new PreConditionNotMetException('The view passed to the node should not have any fake root set'); } @@ -285,7 +285,11 @@ public function isCreatable() { return $this->getFileInfo()->isCreatable(); } - public function getParent(): INode|IRootFolder { + /** + * @return INode|IRootFolder + * @throws NotFoundException + */ + public function getParent() { if ($this->parent === null) { $newPath = dirname($this->path); if ($newPath === '' || $newPath === '.' || $newPath === '/') { diff --git a/lib/private/Files/Node/Root.php b/lib/private/Files/Node/Root.php index 6b82c9f7250a8..e102d993c1084 100644 --- a/lib/private/Files/Node/Root.php +++ b/lib/private/Files/Node/Root.php @@ -336,9 +336,10 @@ public function isShareable() { } /** + * @return INode|IRootFolder * @throws \OCP\Files\NotFoundException */ - public function getParent(): INode|IRootFolder { + public function getParent() { throw new NotFoundException(); }