Attempt to fix psalm false-positive

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2021-04-12 08:49:25 +02:00
parent 0f10e1f0e1
commit 6b6aef03f7
3 changed files with 7 additions and 4 deletions

View File

@@ -35,7 +35,7 @@ use OCP\IDBConnection;
use OCP\IL10N;
use OCP\IPreview;
use OCP\IRequest;
use OCP\Share;
use OCP\Share\Exceptions\ShareNotFound;
use OCP\Share\IManager;
use OCP\Share\IShare;
@@ -140,9 +140,10 @@ class FilesAppService implements IAttachmentService, ICustomAttachmentService {
}
public function display(Attachment $attachment) {
/** @psalm-suppress InvalidCatch */
try {
$share = $this->shareProvider->getShareById($attachment->getId());
} catch (Share\Exceptions\ShareNotFound $e) {
} catch (ShareNotFound $e) {
throw new NotFoundException('File not found');
}
$file = $share->getNode();

View File

@@ -562,6 +562,7 @@ class DeckShareProvider implements \OCP\Share\IShareProvider {
/**
* @inheritDoc
* @throws ShareNotFound
*/
public function getShareById($id, $recipientId = null) {
$qb = $this->dbConnection->getQueryBuilder();

View File

@@ -270,7 +270,7 @@
<code>$this-&gt;rootFolder</code>
<code>$this-&gt;rootFolder</code>
<code>IRootFolder</code>
<code>Share\Exceptions\ShareNotFound</code>
<code>ShareNotFound</code>
</MissingDependency>
</file>
<file src="lib/Service/PermissionService.php">
@@ -298,7 +298,7 @@
<InvalidReturnType occurrences="1">
<code>getSharesInFolder</code>
</InvalidReturnType>
<MissingDependency occurrences="7">
<MissingDependency occurrences="8">
<code>GenericShareException</code>
<code>GenericShareException</code>
<code>ShareNotFound</code>
@@ -306,6 +306,7 @@
<code>ShareNotFound</code>
<code>ShareNotFound</code>
<code>ShareNotFound</code>
<code>ShareNotFound</code>
</MissingDependency>
</file>
<file src="lib/Sharing/Listener.php">