Skip to content

Commit

Permalink
Suppress Phan warnings about calling undeclared class methods
Browse files Browse the repository at this point in the history
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 <danxuliu@gmail.com>
  • Loading branch information
danxuliu committed Jul 25, 2018
1 parent 5326296 commit a693e11
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ public function __construct(string $appName,
$this->serverContainer = $serverContainer;
}

/**
* @suppress PhanUndeclaredClassMethod
*/
private function formatShare(IShare $share): array {

$result = [
Expand Down
5 changes: 5 additions & 0 deletions apps/files_sharing/lib/Controller/ShareAPIController.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ public function __construct(
* @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());
Expand Down Expand Up @@ -914,6 +916,9 @@ public function updateShare(
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) {
Expand Down

0 comments on commit a693e11

Please sign in to comment.