From e2e6f23b6722eaf9c0aa2bf94626c6b1674aff0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Tue, 24 Jul 2018 11:57:52 +0200 Subject: [PATCH] Suppress Phan warnings about calling undeclared class methods MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The DeletedShareAPIController and ShareAPIController helpers for room shares are defined in Talk, so the classes do not exist when Talk is not installed. Due to this when the object returned by "getRoomShareHelper" is used Phan complains that the class is not declared. This is not a problem, though, because when the class is not available "getRoomShareHelper" throws an exception, which is then caught where that method was called. Therefore now those warnings from Phan are suppressed (it would be better to use "@phan-suppress-next-line" instead, but it is not yet available in our Phan version). Signed-off-by: Daniel Calviño Sánchez --- .../lib/Controller/DeletedShareAPIController.php | 3 +++ apps/files_sharing/lib/Controller/ShareAPIController.php | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/apps/files_sharing/lib/Controller/DeletedShareAPIController.php b/apps/files_sharing/lib/Controller/DeletedShareAPIController.php index 7648c4e432..6c7242ef61 100644 --- a/apps/files_sharing/lib/Controller/DeletedShareAPIController.php +++ b/apps/files_sharing/lib/Controller/DeletedShareAPIController.php @@ -86,6 +86,9 @@ class DeletedShareAPIController extends OCSController { $this->serverContainer = $serverContainer; } + /** + * @suppress PhanUndeclaredClassMethod + */ private function formatShare(IShare $share): array { $result = [ diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php index 15dda8928d..461c0e4732 100644 --- a/apps/files_sharing/lib/Controller/ShareAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareAPIController.php @@ -141,6 +141,8 @@ class ShareAPIController extends OCSController { * @param Node|null $recipientNode * @return array * @throws NotFoundException In case the node can't be resolved. + * + * @suppress PhanUndeclaredClassMethod */ protected function formatShare(\OCP\Share\IShare $share, Node $recipientNode = null): array { $sharedBy = $this->userManager->get($share->getSharedBy()); @@ -914,6 +916,9 @@ class ShareAPIController extends OCSController { return new DataResponse($this->formatShare($share)); } + /** + * @suppress PhanUndeclaredClassMethod + */ protected function canAccessShare(\OCP\Share\IShare $share, bool $checkGroups = true): bool { // A file with permissions 0 can't be accessed by us. So Don't show it if ($share->getPermissions() === 0) {