mirror of
https://github.com/nextcloud/server.git
synced 2026-04-15 22:11:17 -04:00
Fix psalm errors related to filesizes
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
parent
ff776a90b1
commit
d9dbed9105
5 changed files with 11 additions and 11 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -184,13 +184,10 @@ class LargeFileHelper {
|
|||
|
||||
/**
|
||||
* Returns the current mtime for $fullPath
|
||||
*
|
||||
* @param string $fullPath
|
||||
* @return int
|
||||
*/
|
||||
public function getFileMtime(string $fullPath): int {
|
||||
try {
|
||||
$result = filemtime($fullPath);
|
||||
$result = filemtime($fullPath) ?: -1;
|
||||
} catch (\Exception $e) {
|
||||
$result = - 1;
|
||||
}
|
||||
|
|
@ -198,7 +195,7 @@ class LargeFileHelper {
|
|||
if (\OCP\Util::isFunctionEnabled('exec')) {
|
||||
$os = strtolower(php_uname('s'));
|
||||
if (strpos($os, 'linux') !== false) {
|
||||
return $this->exec('stat -c %Y ' . escapeshellarg($fullPath));
|
||||
return (int)($this->exec('stat -c %Y ' . escapeshellarg($fullPath)) ?? -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue