From 1fbb6a9c7ed62fa91619615316c8dd4ab32178b1 Mon Sep 17 00:00:00 2001 From: Maxence Lange Date: Sun, 1 Sep 2024 20:48:20 -0100 Subject: [PATCH] fix psalm Signed-off-by: Maxence Lange --- lib/private/AllConfig.php | 11 +++++++++-- lib/private/UserPreferences.php | 4 ++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/private/AllConfig.php b/lib/private/AllConfig.php index e73e2fdef91b7..ba04068f12123 100644 --- a/lib/private/AllConfig.php +++ b/lib/private/AllConfig.php @@ -243,7 +243,7 @@ public function setUserValue($userId, $appName, $key, $value, $preCondition = nu } } - $userPreferences->setValueMixed($userId, $appName, $key, $value); + $userPreferences->setValueMixed($userId, $appName, $key, (string)$value); } /** @@ -314,7 +314,14 @@ public function getAllUserValues(?string $userId): array { return []; } - return \OC::$server->get(UserPreferences::class)->getAllValues($userId); + $values = \OC::$server->get(UserPreferences::class)->getAllValues($userId); + $result = []; + foreach($values as $app => $list) { + foreach($list as $key => $value) { + $result[$app][$key] = (string)$value; + } + } + return $result; } /** diff --git a/lib/private/UserPreferences.php b/lib/private/UserPreferences.php index 8fe59b51d5b97..53a647a51de67 100644 --- a/lib/private/UserPreferences.php +++ b/lib/private/UserPreferences.php @@ -144,7 +144,7 @@ public function hasKey(string $userId, string $app, string $key, ?bool $lazy = f $this->loadPreferences($userId, $lazy); if ($lazy === null) { - $appCache = $this->getAllValues($userId, $app); + $appCache = $this->getValues($userId, $app); return isset($appCache[$key]); } @@ -451,7 +451,7 @@ public function getValueMixed( string $userId, string $app, string $key, - string $default = '', + ?string $default = '', ?bool $lazy = false ): string { try {