diff options
Diffstat (limited to 'lib/private/Files/Node/Node.php')
-rw-r--r-- | lib/private/Files/Node/Node.php | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/private/Files/Node/Node.php b/lib/private/Files/Node/Node.php index 9a1630ebde0..7c8c0197834 100644 --- a/lib/private/Files/Node/Node.php +++ b/lib/private/Files/Node/Node.php @@ -35,6 +35,7 @@ use OC\Files\Utils\PathHelper; use OCP\Files\FileInfo; use OCP\Files\InvalidPathException; use OCP\Files\IRootFolder; +use OCP\Files\Node as INode; use OCP\Files\NotFoundException; use OCP\Files\NotPermittedException; use OCP\Lock\LockedException; @@ -42,7 +43,7 @@ use OCP\PreConditionNotMetException; use Symfony\Component\EventDispatcher\GenericEvent; // FIXME: this class really should be abstract -class Node implements \OCP\Files\Node { +class Node implements INode { /** * @var \OC\Files\View $view */ @@ -122,7 +123,9 @@ class Node implements \OCP\Files\Node { $args = !empty($args) ? $args : [$this]; $dispatcher = \OC::$server->getEventDispatcher(); foreach ($hooks as $hook) { - $this->root->emit('\OC\Files', $hook, $args); + if (method_exists($this->root, 'emit')) { + $this->root->emit('\OC\Files', $hook, $args); + } $dispatcher->dispatch('\OCP\Files::' . $hook, new GenericEvent($args)); } } @@ -282,10 +285,7 @@ class Node implements \OCP\Files\Node { return $this->getFileInfo()->isCreatable(); } - /** - * @return Node - */ - public function getParent() { + public function getParent(): INode|IRootFolder { if ($this->parent === null) { $newPath = dirname($this->path); if ($newPath === '' || $newPath === '.' || $newPath === '/') { @@ -394,7 +394,7 @@ class Node implements \OCP\Files\Node { /** * @param string $targetPath - * @return \OCP\Files\Node + * @return INode * @throws InvalidPathException * @throws NotFoundException * @throws NotPermittedException if copy not allowed or failed @@ -420,7 +420,7 @@ class Node implements \OCP\Files\Node { /** * @param string $targetPath - * @return \OCP\Files\Node + * @return INode * @throws InvalidPathException * @throws NotFoundException * @throws NotPermittedException if move not allowed or failed |