From 6a58a10c86d29c8d3bb8c7bda58a33d52a3f8926 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Sat, 14 Oct 2023 18:15:01 -0700 Subject: [PATCH] psalm: remove more dead code Signed-off-by: Varun Patil --- lib/Controller/ArchiveController.php | 5 +---- lib/Controller/ShareController.php | 2 -- lib/Util.php | 4 ++++ psalm-ls.xml | 7 +++++++ psalm.xml | 7 +++++++ 5 files changed, 19 insertions(+), 6 deletions(-) diff --git a/lib/Controller/ArchiveController.php b/lib/Controller/ArchiveController.php index c3431b7f..a82cc640 100644 --- a/lib/Controller/ArchiveController.php +++ b/lib/Controller/ArchiveController.php @@ -57,15 +57,12 @@ class ArchiveController extends GenericApiController // Create archive folder in the root of the user's configured timeline $configPaths = Util::getTimelinePaths(Util::getUID()); - $timelineFolders = []; $timelinePaths = []; // Get all timeline paths foreach ($configPaths as $path) { try { - $f = $userFolder->get($path); - $timelineFolders[] = $f; - $timelinePaths[] = $f->getPath(); + $timelinePaths[] = $userFolder->get($path)->getPath(); } catch (\OCP\Files\NotFoundException $e) { throw Exceptions::NotFound("timeline folder {$path}"); } diff --git a/lib/Controller/ShareController.php b/lib/Controller/ShareController.php index 60292c28..18f3eb1d 100644 --- a/lib/Controller/ShareController.php +++ b/lib/Controller/ShareController.php @@ -70,10 +70,8 @@ class ShareController extends GenericApiController return Util::guardEx(function () use ($id, $path) { $file = $this->getNodeByIdOrPath($id, $path); - /** @var \OCP\Share\IManager $shareManager */ $shareManager = \OC::$server->get(\OCP\Share\IManager::class); - /** @var \OCP\Share\IShare $share */ $share = $shareManager->newShare(); $share->setNode($file); $share->setShareType(\OCP\Share\IShare::TYPE_LINK); diff --git a/lib/Util.php b/lib/Util.php index 17314762..f81e6b49 100644 --- a/lib/Util.php +++ b/lib/Util.php @@ -170,6 +170,10 @@ class Util /** * Check if link sharing is allowed. + * + * @todo Check if link sharing is enabled to show the button + * + * @psalm-suppress PossiblyUnusedMethod */ public static function isLinkSharingEnabled(): bool { diff --git a/psalm-ls.xml b/psalm-ls.xml index 43ee8843..83b277b3 100644 --- a/psalm-ls.xml +++ b/psalm-ls.xml @@ -7,6 +7,8 @@ xmlns="https://getpsalm.org/schema/config" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" cacheDirectory=".cache/psalm-ls" + findUnusedBaselineEntry="true" + findUnusedCode="false" > @@ -35,6 +37,11 @@ + + + + +