summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2022-05-16 18:30:09 +0200
committerGitHub <noreply@github.com>2022-05-16 18:30:09 +0200
commit03c46cf1151da2d107fd695899853b888aecd4de (patch)
tree34f198ededac94e9a3734bdf7b3bdc0736bcad81 /lib/private
parent8100580b5d5c7f7f6dbf4bac78b04465a2e33f61 (diff)
parent53169890d6dccfcc48d80930e33824084d68aa1c (diff)
downloadnextcloud-server-03c46cf1151da2d107fd695899853b888aecd4de.tar.gz
nextcloud-server-03c46cf1151da2d107fd695899853b888aecd4de.zip
Merge pull request #32413 from nextcloud/fix/psalm-oc-legacy
Fix psalm errors from the end of the baseline file
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/legacy/OC_Helper.php10
-rw-r--r--lib/private/legacy/OC_Util.php21
2 files changed, 8 insertions, 23 deletions
diff --git a/lib/private/legacy/OC_Helper.php b/lib/private/legacy/OC_Helper.php
index 6aa0b582c21..226f73a0711 100644
--- a/lib/private/legacy/OC_Helper.php
+++ b/lib/private/legacy/OC_Helper.php
@@ -95,7 +95,7 @@ class OC_Helper {
/**
* Make a computer file size
* @param string $str file size in human readable format
- * @return float|bool a file size in bytes
+ * @return float|false a file size in bytes
*
* Makes 2kB to 2048.
*
@@ -420,11 +420,11 @@ class OC_Helper {
*/
public static function uploadLimit() {
$ini = \OC::$server->get(IniGetWrapper::class);
- $upload_max_filesize = OCP\Util::computerFileSize($ini->get('upload_max_filesize'));
- $post_max_size = OCP\Util::computerFileSize($ini->get('post_max_size'));
- if ((int)$upload_max_filesize === 0 and (int)$post_max_size === 0) {
+ $upload_max_filesize = (int)OCP\Util::computerFileSize($ini->get('upload_max_filesize'));
+ $post_max_size = (int)OCP\Util::computerFileSize($ini->get('post_max_size'));
+ if ($upload_max_filesize === 0 && $post_max_size === 0) {
return INF;
- } elseif ((int)$upload_max_filesize === 0 or (int)$post_max_size === 0) {
+ } elseif ($upload_max_filesize === 0 || $post_max_size === 0) {
return max($upload_max_filesize, $post_max_size); //only the non 0 value counts
} else {
return min($upload_max_filesize, $post_max_size);
diff --git a/lib/private/legacy/OC_Util.php b/lib/private/legacy/OC_Util.php
index ee7fb517d98..516ccc8283c 100644
--- a/lib/private/legacy/OC_Util.php
+++ b/lib/private/legacy/OC_Util.php
@@ -158,7 +158,7 @@ class OC_Util {
* Get the quota of a user
*
* @param IUser|null $user
- * @return float Quota bytes
+ * @return float|\OCP\Files\FileInfo::SPACE_UNLIMITED|false Quota bytes
*/
public static function getUserQuota(?IUser $user) {
if (is_null($user)) {
@@ -657,20 +657,8 @@ class OC_Util {
}
}
foreach ($dependencies['ini'] as $setting => $expected) {
- if (is_bool($expected)) {
- if ($iniWrapper->getBool($setting) !== $expected) {
- $invalidIniSettings[] = [$setting, $expected];
- }
- }
- if (is_int($expected)) {
- if ($iniWrapper->getNumeric($setting) !== $expected) {
- $invalidIniSettings[] = [$setting, $expected];
- }
- }
- if (is_string($expected)) {
- if (strtolower($iniWrapper->getString($setting)) !== strtolower($expected)) {
- $invalidIniSettings[] = [$setting, $expected];
- }
+ if (strtolower($iniWrapper->getString($setting)) !== strtolower($expected)) {
+ $invalidIniSettings[] = [$setting, $expected];
}
}
@@ -682,9 +670,6 @@ class OC_Util {
$webServerRestart = true;
}
foreach ($invalidIniSettings as $setting) {
- if (is_bool($setting[1])) {
- $setting[1] = $setting[1] ? 'on' : 'off';
- }
$errors[] = [
'error' => $l->t('PHP setting "%s" is not set to "%s".', [$setting[0], var_export($setting[1], true)]),
'hint' => $l->t('Adjusting this setting in php.ini will make Nextcloud run again')