summaryrefslogtreecommitdiffstats
path: root/lib/private/Files
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2023-01-23 09:55:03 +0100
committerCôme Chilliet <come.chilliet@nextcloud.com>2023-02-07 11:23:29 +0100
commitd9dbed91050e80ab15768c278a1aecdfc3a1efda (patch)
tree6b29c1164d64e22f06c426175d0195f1d412a4f0 /lib/private/Files
parentff776a90b133fa113c29511a5a7983a7a1a8b73c (diff)
downloadnextcloud-server-d9dbed91050e80ab15768c278a1aecdfc3a1efda.tar.gz
nextcloud-server-d9dbed91050e80ab15768c278a1aecdfc3a1efda.zip
Fix psalm errors related to filesizes
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'lib/private/Files')
-rw-r--r--lib/private/Files/Storage/Common.php4
-rw-r--r--lib/private/Files/Storage/Wrapper/Availability.php3
-rw-r--r--lib/private/Files/Storage/Wrapper/Encryption.php2
-rw-r--r--lib/private/Files/Stream/Encryption.php6
4 files changed, 9 insertions, 6 deletions
diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php
index 8b46df3df6e..22b2e8164fb 100644
--- a/lib/private/Files/Storage/Common.php
+++ b/lib/private/Files/Storage/Common.php
@@ -695,9 +695,9 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage {
$result = $this->copyFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath, true);
if ($result) {
if ($sourceStorage->is_dir($sourceInternalPath)) {
- $result = $result && $sourceStorage->rmdir($sourceInternalPath);
+ $result = $sourceStorage->rmdir($sourceInternalPath);
} else {
- $result = $result && $sourceStorage->unlink($sourceInternalPath);
+ $result = $sourceStorage->unlink($sourceInternalPath);
}
}
return $result;
diff --git a/lib/private/Files/Storage/Wrapper/Availability.php b/lib/private/Files/Storage/Wrapper/Availability.php
index 2d3d33ff024..661bf636711 100644
--- a/lib/private/Files/Storage/Wrapper/Availability.php
+++ b/lib/private/Files/Storage/Wrapper/Availability.php
@@ -451,6 +451,9 @@ class Availability extends Wrapper {
}
/**
+ * @template T of StorageNotAvailableException|null
+ * @param T $e
+ * @psalm-return (T is null ? void : never)
* @throws StorageNotAvailableException
*/
protected function setUnavailable(?StorageNotAvailableException $e): void {
diff --git a/lib/private/Files/Storage/Wrapper/Encryption.php b/lib/private/Files/Storage/Wrapper/Encryption.php
index 7c453e95092..f66661a615f 100644
--- a/lib/private/Files/Storage/Wrapper/Encryption.php
+++ b/lib/private/Files/Storage/Wrapper/Encryption.php
@@ -134,7 +134,7 @@ class Encryption extends Wrapper {
* see https://www.php.net/manual/en/function.filesize.php
* The result for filesize when called on a folder is required to be 0
*/
- public function filesize(string $path): int|float {
+ public function filesize(string $path): false|int|float {
$fullPath = $this->getFullPath($path);
/** @var CacheEntry $info */
diff --git a/lib/private/Files/Stream/Encryption.php b/lib/private/Files/Stream/Encryption.php
index cebf7bafced..bcf0a10740b 100644
--- a/lib/private/Files/Stream/Encryption.php
+++ b/lib/private/Files/Stream/Encryption.php
@@ -143,8 +143,8 @@ class Encryption extends Wrapper {
* @param \OC\Encryption\Util $util
* @param \OC\Encryption\File $file
* @param string $mode
- * @param int $size
- * @param int $unencryptedSize
+ * @param int|float $size
+ * @param int|float $unencryptedSize
* @param int $headerSize
* @param bool $signed
* @param string $wrapper stream wrapper class
@@ -158,7 +158,7 @@ class Encryption extends Wrapper {
\OC\Files\Storage\Storage $storage,
\OC\Files\Storage\Wrapper\Encryption $encStorage,
\OC\Encryption\Util $util,
- \OC\Encryption\File $file,
+ \OC\Encryption\File $file,
$mode,
$size,
$unencryptedSize,