Skip to content

Commit

Permalink
Fix more psalm warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Roeland Jago Douma <[email protected]>
  • Loading branch information
rullzer authored and MorrisJobke committed May 21, 2021
1 parent eb1d16d commit bcf01a1
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions apps/files/lib/Controller/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand All @@ -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();
}

Expand All @@ -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();
}

Expand All @@ -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();
}
}
Expand Down

0 comments on commit bcf01a1

Please sign in to comment.