Skip to content

Commit

Permalink
Merge pull request #48455 from nextcloud/update-phpdoc-for-folder-get
Browse files Browse the repository at this point in the history
update docs for Folder.get and call for Folder.nodeExists
  • Loading branch information
kesselb authored Sep 30, 2024
2 parents b05c2dc + fbaa4cc commit 99d507c
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 28 deletions.
4 changes: 0 additions & 4 deletions build/psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1976,7 +1976,6 @@
</file>
<file src="lib/private/Files/Node/Folder.php">
<LessSpecificReturnStatement>
<code><![CDATA[$this->root->get($this->getFullPath($path))]]></code>
<code><![CDATA[array_map(function (FileInfo $file) {
return $this->createNode($file->getPath(), $file);
}, $files)]]></code>
Expand All @@ -1985,7 +1984,6 @@
<code><![CDATA[$node]]></code>
</MoreSpecificImplementedParamType>
<MoreSpecificReturnType>
<code><![CDATA[\OC\Files\Node\Node]]></code>
<code><![CDATA[\OC\Files\Node\Node[]]]></code>
</MoreSpecificReturnType>
</file>
Expand Down Expand Up @@ -2046,15 +2044,13 @@
<file src="lib/private/Files/Node/Root.php">
<LessSpecificReturnStatement>
<code><![CDATA[$folders]]></code>
<code><![CDATA[$this->createNode($fullPath, $fileInfo, false)]]></code>
<code><![CDATA[$this->mountManager->findByNumericId($numericId)]]></code>
<code><![CDATA[$this->mountManager->findByStorageId($storageId)]]></code>
<code><![CDATA[$this->mountManager->findIn($mountPoint)]]></code>
<code><![CDATA[$this->user]]></code>
</LessSpecificReturnStatement>
<MoreSpecificReturnType>
<code><![CDATA[MountPoint[]]]></code>
<code><![CDATA[Node]]></code>
<code><![CDATA[\OC\Files\Mount\MountPoint[]]]></code>
<code><![CDATA[\OC\Files\Mount\MountPoint[]]]></code>
<code><![CDATA[\OC\User\User]]></code>
Expand Down
13 changes: 1 addition & 12 deletions lib/private/Files/Node/Folder.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,26 +103,15 @@ protected function createNode(string $path, ?FileInfo $info = null, bool $infoHa
}
}

/**
* Get the node at $path
*
* @param string $path
* @return \OC\Files\Node\Node
* @throws \OCP\Files\NotFoundException
*/
public function get($path) {
return $this->root->get($this->getFullPath($path));
}

/**
* @param string $path
* @return bool
*/
public function nodeExists($path) {
try {
$this->get($path);
return true;
} catch (NotFoundException $e) {
} catch (NotFoundException|NotPermittedException) {
return false;
}
}
Expand Down
6 changes: 0 additions & 6 deletions lib/private/Files/Node/LazyFolder.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,6 @@ public function unMount($mount) {
$this->__call(__FUNCTION__, func_get_args());
}

/**
* @inheritDoc
*/
public function get($path) {
return $this->getRootFolder()->get($this->getFullPath($path));
}
Expand Down Expand Up @@ -422,9 +419,6 @@ public function getDirectoryListing() {
return $this->__call(__FUNCTION__, func_get_args());
}

/**
* @inheritDoc
*/
public function nodeExists($path) {
return $this->__call(__FUNCTION__, func_get_args());
}
Expand Down
6 changes: 0 additions & 6 deletions lib/private/Files/Node/Root.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,6 @@ public function unMount($mount) {
$this->mountManager->remove($mount);
}

/**
* @param string $path
* @return Node
* @throws \OCP\Files\NotPermittedException
* @throws \OCP\Files\NotFoundException
*/
public function get($path) {
$path = $this->normalizePath($path);
if ($this->isValidPath($path)) {
Expand Down
1 change: 1 addition & 0 deletions lib/public/Files/Folder.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public function getDirectoryListing();
* @param string $path relative path of the file or folder
* @return \OCP\Files\Node
* @throws \OCP\Files\NotFoundException
* @throws \OCP\Files\NotPermittedException
* @since 6.0.0
*/
public function get($path);
Expand Down

0 comments on commit 99d507c

Please sign in to comment.