From eb1d16d92df7322be04c4be467b353715f7fd3e9 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Thu, 1 Apr 2021 18:53:41 +0200 Subject: [PATCH 1/2] Add proper PHPDoc tags to files ApiController Signed-off-by: Morris Jobke --- apps/files/lib/Controller/ApiController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/files/lib/Controller/ApiController.php b/apps/files/lib/Controller/ApiController.php index 20f60cde30d6c..8bcd655616a37 100644 --- a/apps/files/lib/Controller/ApiController.php +++ b/apps/files/lib/Controller/ApiController.php @@ -67,9 +67,9 @@ class ApiController extends Controller { private $shareManager; /** @var IPreview */ private $previewManager; - /** IUserSession */ + /** @var IUserSession */ private $userSession; - /** IConfig */ + /** @var IConfig */ private $config; /** @var Folder */ private $userFolder; From bcf01a1b9006e82ea5fdec7876efa72dd567f1f8 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Fri, 9 Apr 2021 10:10:15 +0200 Subject: [PATCH 2/2] Fix more psalm warnings Signed-off-by: Roeland Jago Douma --- apps/files/lib/Controller/ApiController.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/apps/files/lib/Controller/ApiController.php b/apps/files/lib/Controller/ApiController.php index 8bcd655616a37..fba62107cd7e9 100644 --- a/apps/files/lib/Controller/ApiController.php +++ b/apps/files/lib/Controller/ApiController.php @@ -291,8 +291,8 @@ public function updateFileSorting($mode, $direction) { * @return Response * @throws \OCP\PreConditionNotMetException */ - public function showHiddenFiles($show) { - $this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'show_hidden', (int)$show); + public function showHiddenFiles(bool $show): Response { + $this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'show_hidden', $show ? '1' : '0'); return new Response(); } @@ -305,8 +305,8 @@ public function showHiddenFiles($show) { * @return Response * @throws \OCP\PreConditionNotMetException */ - public function cropImagePreviews($crop) { - $this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'crop_image_previews', (int)$crop); + public function cropImagePreviews(bool $crop): Response { + $this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'crop_image_previews', $crop ? '1' : '0'); return new Response(); } @@ -319,8 +319,8 @@ public function cropImagePreviews($crop) { * @return Response * @throws \OCP\PreConditionNotMetException */ - public function showGridView($show) { - $this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'show_grid', (int)$show); + public function showGridView(bool $show): Response { + $this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'show_grid', $show ? '1' : '0'); return new Response(); } @@ -345,13 +345,13 @@ public function getGridView() { * @return Response * @throws \OCP\PreConditionNotMetException */ - public function toggleShowFolder(int $show, string $key) { + public function toggleShowFolder(int $show, string $key): Response { // ensure the edited key exists $navItems = \OCA\Files\App::getNavigationManager()->getAll(); foreach ($navItems as $item) { // check if data is valid if (($show === 0 || $show === 1) && isset($item['expandedState']) && $key === $item['expandedState']) { - $this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', $key, $show); + $this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', $key, (string)$show); return new Response(); } }