fix: adjust to PHP level and codebase

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
Arthur Schiwon 2023-07-04 23:36:06 +02:00
parent 2930f890d6
commit 1eb9f1874d
No known key found for this signature in database
GPG key ID: 7424F1874854DF23
3 changed files with 11 additions and 6 deletions

View file

@ -109,7 +109,7 @@ class Folder extends Node implements \OCP\Files\Folder {
}, $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 @@ class Folder extends Node implements \OCP\Files\Folder {
* @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 @@ class Folder extends Node implements \OCP\Files\Folder {
}
$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 [];
}

View file

@ -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 @@ class Node implements INode {
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 === '/') {

View file

@ -336,9 +336,10 @@ class Root extends Folder implements IRootFolder {
}
/**
* @return INode|IRootFolder
* @throws \OCP\Files\NotFoundException
*/
public function getParent(): INode|IRootFolder {
public function getParent() {
throw new NotFoundException();
}