aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/dav/lib/Connector/Sabre/FilesPlugin.php6
-rw-r--r--apps/dav/lib/Connector/Sabre/Node.php11
-rw-r--r--apps/dav/lib/Connector/Sabre/QuotaPlugin.php2
-rw-r--r--apps/dav/lib/Upload/UploadFile.php4
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php2
-rw-r--r--apps/files_trashbin/lib/Sabre/AbstractTrash.php2
-rw-r--r--lib/private/Files/Node/LazyFolder.php2
-rw-r--r--lib/private/Files/Node/Node.php4
-rw-r--r--lib/private/Files/Node/NonExistingFile.php2
-rw-r--r--lib/private/Files/Node/NonExistingFolder.php2
-rw-r--r--lib/private/Files/Node/Root.php4
-rw-r--r--lib/private/Files/SimpleFS/NewSimpleFile.php2
-rw-r--r--lib/private/Files/SimpleFS/SimpleFile.php2
-rw-r--r--lib/private/Streamer.php12
-rw-r--r--lib/private/legacy/OC_Files.php15
-rw-r--r--lib/public/Files/Node.php2
-rw-r--r--lib/public/Files/SimpleFS/ISimpleFile.php2
-rw-r--r--lib/public/Files/SimpleFS/InMemoryFile.php2
18 files changed, 35 insertions, 43 deletions
diff --git a/apps/dav/lib/Connector/Sabre/FilesPlugin.php b/apps/dav/lib/Connector/Sabre/FilesPlugin.php
index f53c62afba2..a6c9b8b4ebe 100644
--- a/apps/dav/lib/Connector/Sabre/FilesPlugin.php
+++ b/apps/dav/lib/Connector/Sabre/FilesPlugin.php
@@ -53,10 +53,8 @@ use Sabre\DAV\Server;
use Sabre\DAV\Tree;
use Sabre\HTTP\RequestInterface;
use Sabre\HTTP\ResponseInterface;
-use Sabre\Uri;
class FilesPlugin extends ServerPlugin {
-
// namespace
public const NS_OWNCLOUD = 'http://owncloud.org/ns';
public const NS_NEXTCLOUD = 'http://nextcloud.org/ns';
@@ -352,7 +350,7 @@ class FilesPlugin extends ServerPlugin {
$propFind->handle(self::HAS_PREVIEW_PROPERTYNAME, function () use ($node) {
return json_encode($this->previewManager->isAvailable($node->getFileInfo()), JSON_THROW_ON_ERROR);
});
- $propFind->handle(self::SIZE_PROPERTYNAME, function () use ($node): ?int {
+ $propFind->handle(self::SIZE_PROPERTYNAME, function () use ($node): int|float {
return $node->getSize();
});
$propFind->handle(self::MOUNT_TYPE_PROPERTYNAME, function () use ($node) {
@@ -382,7 +380,7 @@ class FilesPlugin extends ServerPlugin {
});
/**
* Return file/folder name as displayname. The primary reason to
- * implement it this way is to avoid costly fallback to
+ * implement it this way is to avoid costly fallback to
* CustomPropertiesBackend (esp. visible when querying all files
* in a folder).
*/
diff --git a/apps/dav/lib/Connector/Sabre/Node.php b/apps/dav/lib/Connector/Sabre/Node.php
index 843d48e7450..cce48bf4839 100644
--- a/apps/dav/lib/Connector/Sabre/Node.php
+++ b/apps/dav/lib/Connector/Sabre/Node.php
@@ -67,10 +67,7 @@ abstract class Node implements \Sabre\DAV\INode {
*/
protected $property_cache = null;
- /**
- * @var \OCP\Files\FileInfo
- */
- protected $info;
+ protected FileInfo $info;
/**
* @var IManager
@@ -81,10 +78,6 @@ abstract class Node implements \Sabre\DAV\INode {
/**
* Sets up the node, expects a full path name
- *
- * @param \OC\Files\View $view
- * @param \OCP\Files\FileInfo $info
- * @param IManager $shareManager
*/
public function __construct(View $view, FileInfo $info, IManager $shareManager = null) {
$this->fileView = $view;
@@ -232,7 +225,7 @@ abstract class Node implements \Sabre\DAV\INode {
*
* @return int|float
*/
- public function getSize() {
+ public function getSize(): int|float {
return $this->info->getSize();
}
diff --git a/apps/dav/lib/Connector/Sabre/QuotaPlugin.php b/apps/dav/lib/Connector/Sabre/QuotaPlugin.php
index ff7396a0825..ddf4b2773e0 100644
--- a/apps/dav/lib/Connector/Sabre/QuotaPlugin.php
+++ b/apps/dav/lib/Connector/Sabre/QuotaPlugin.php
@@ -178,7 +178,7 @@ class QuotaPlugin extends \Sabre\DAV\ServerPlugin {
* This method is called before any HTTP method and validates there is enough free space to store the file
*
* @param string $path relative to the users home
- * @param int $length
+ * @param int|float|null $length
* @throws InsufficientStorage
* @return bool
*/
diff --git a/apps/dav/lib/Upload/UploadFile.php b/apps/dav/lib/Upload/UploadFile.php
index 49a2fadecf6..47d03e3e448 100644
--- a/apps/dav/lib/Upload/UploadFile.php
+++ b/apps/dav/lib/Upload/UploadFile.php
@@ -29,7 +29,6 @@ use OCA\DAV\Connector\Sabre\File;
use Sabre\DAV\IFile;
class UploadFile implements IFile {
-
/** @var File */
private $file;
@@ -53,6 +52,9 @@ class UploadFile implements IFile {
return $this->file->getETag();
}
+ /**
+ * @return int|float
+ */
public function getSize() {
return $this->file->getSize();
}
diff --git a/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php
index d38031b03d4..3119d715bec 100644
--- a/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php
@@ -261,6 +261,8 @@ class FilesReportPluginTest extends \Test\TestCase {
$filesNode2 = $this->getMockBuilder(File::class)
->disableOriginalConstructor()
->getMock();
+ $filesNode2->method('getSize')
+ ->willReturn(10);
$this->userFolder->expects($this->exactly(2))
->method('getById')
diff --git a/apps/files_trashbin/lib/Sabre/AbstractTrash.php b/apps/files_trashbin/lib/Sabre/AbstractTrash.php
index 412e432a19e..c30e15c18cb 100644
--- a/apps/files_trashbin/lib/Sabre/AbstractTrash.php
+++ b/apps/files_trashbin/lib/Sabre/AbstractTrash.php
@@ -57,7 +57,7 @@ abstract class AbstractTrash implements ITrash {
return $this->data;
}
- public function getSize(): int {
+ public function getSize(): int|float {
return $this->data->getSize();
}
diff --git a/lib/private/Files/Node/LazyFolder.php b/lib/private/Files/Node/LazyFolder.php
index 1bae0f52e59..cc1f64889a1 100644
--- a/lib/private/Files/Node/LazyFolder.php
+++ b/lib/private/Files/Node/LazyFolder.php
@@ -225,7 +225,7 @@ class LazyFolder implements \OCP\Files\Folder {
/**
* @inheritDoc
*/
- public function getSize($includeMounts = true) {
+ public function getSize($includeMounts = true): int|float {
return $this->__call(__FUNCTION__, func_get_args());
}
diff --git a/lib/private/Files/Node/Node.php b/lib/private/Files/Node/Node.php
index 8a752ff281d..6c4e0b0f908 100644
--- a/lib/private/Files/Node/Node.php
+++ b/lib/private/Files/Node/Node.php
@@ -209,11 +209,11 @@ class Node implements \OCP\Files\Node {
/**
* @param bool $includeMounts
- * @return int
+ * @return int|float
* @throws InvalidPathException
* @throws NotFoundException
*/
- public function getSize($includeMounts = true) {
+ public function getSize($includeMounts = true): int|float {
return $this->getFileInfo()->getSize($includeMounts);
}
diff --git a/lib/private/Files/Node/NonExistingFile.php b/lib/private/Files/Node/NonExistingFile.php
index e1d706006ba..b21a2a6c65b 100644
--- a/lib/private/Files/Node/NonExistingFile.php
+++ b/lib/private/Files/Node/NonExistingFile.php
@@ -65,7 +65,7 @@ class NonExistingFile extends File {
}
}
- public function getSize($includeMounts = true) {
+ public function getSize($includeMounts = true): int|float {
if ($this->fileInfo) {
return parent::getSize($includeMounts);
} else {
diff --git a/lib/private/Files/Node/NonExistingFolder.php b/lib/private/Files/Node/NonExistingFolder.php
index d99446e8ff8..100687c3e6f 100644
--- a/lib/private/Files/Node/NonExistingFolder.php
+++ b/lib/private/Files/Node/NonExistingFolder.php
@@ -66,7 +66,7 @@ class NonExistingFolder extends Folder {
}
}
- public function getSize($includeMounts = true) {
+ public function getSize($includeMounts = true): int|float {
if ($this->fileInfo) {
return parent::getSize($includeMounts);
} else {
diff --git a/lib/private/Files/Node/Root.php b/lib/private/Files/Node/Root.php
index ca930c1002c..8d0a65d2a68 100644
--- a/lib/private/Files/Node/Root.php
+++ b/lib/private/Files/Node/Root.php
@@ -290,9 +290,9 @@ class Root extends Folder implements IRootFolder {
/**
* @param bool $includeMounts
- * @return int
+ * @return int|float
*/
- public function getSize($includeMounts = true) {
+ public function getSize($includeMounts = true): int|float {
return 0;
}
diff --git a/lib/private/Files/SimpleFS/NewSimpleFile.php b/lib/private/Files/SimpleFS/NewSimpleFile.php
index e2d1ae274b1..1d0972bcc54 100644
--- a/lib/private/Files/SimpleFS/NewSimpleFile.php
+++ b/lib/private/Files/SimpleFS/NewSimpleFile.php
@@ -56,7 +56,7 @@ class NewSimpleFile implements ISimpleFile {
/**
* Get the size in bytes
*/
- public function getSize(): int {
+ public function getSize(): int|float {
if ($this->file) {
return $this->file->getSize();
} else {
diff --git a/lib/private/Files/SimpleFS/SimpleFile.php b/lib/private/Files/SimpleFS/SimpleFile.php
index a2571ac50e8..95ef332e2f5 100644
--- a/lib/private/Files/SimpleFS/SimpleFile.php
+++ b/lib/private/Files/SimpleFS/SimpleFile.php
@@ -46,7 +46,7 @@ class SimpleFile implements ISimpleFile {
/**
* Get the size in bytes
*/
- public function getSize(): int {
+ public function getSize(): int|float {
return $this->file->getSize();
}
diff --git a/lib/private/Streamer.php b/lib/private/Streamer.php
index 1375489d360..52f824fedf8 100644
--- a/lib/private/Streamer.php
+++ b/lib/private/Streamer.php
@@ -40,7 +40,7 @@ use ZipStreamer\ZipStreamer;
class Streamer {
// array of regexp. Matching user agents will get tar instead of zip
- private $preferTarFor = [ '/macintosh|mac os x/i' ];
+ private array $preferTarFor = [ '/macintosh|mac os x/i' ];
// streamer instance
private $streamerInstance;
@@ -49,11 +49,11 @@ class Streamer {
* Streamer constructor.
*
* @param IRequest $request
- * @param int $size The size of the files in bytes
+ * @param int|float $size The size of the files in bytes
* @param int $numberOfFiles The number of files (and directories) that will
* be included in the streamed file
*/
- public function __construct(IRequest $request, int $size, int $numberOfFiles) {
+ public function __construct(IRequest $request, int|float $size, int $numberOfFiles) {
/**
* zip32 constraints for a basic (without compression, volumes nor
* encryption) zip file according to the Zip specification:
@@ -149,11 +149,11 @@ class Streamer {
*
* @param resource $stream Stream to read data from
* @param string $internalName Filepath and name to be used in the archive.
- * @param int $size Filesize
- * @param int|bool $time File mtime as int, or false
+ * @param int|float $size Filesize
+ * @param int|false $time File mtime as int, or false
* @return bool $success
*/
- public function addFileFromStream($stream, string $internalName, int $size, $time): bool {
+ public function addFileFromStream($stream, string $internalName, int|float $size, $time): bool {
$options = [];
if ($time) {
$options = [
diff --git a/lib/private/legacy/OC_Files.php b/lib/private/legacy/OC_Files.php
index 6a3a44d6cc0..5655139b24a 100644
--- a/lib/private/legacy/OC_Files.php
+++ b/lib/private/legacy/OC_Files.php
@@ -59,14 +59,11 @@ class OC_Files {
public const UPLOAD_MIN_LIMIT_BYTES = 1048576; // 1 MiB
- private static $multipartBoundary = '';
+ private static string $multipartBoundary = '';
- /**
- * @return string
- */
- private static function getBoundary() {
+ private static function getBoundary(): string {
if (empty(self::$multipartBoundary)) {
- self::$multipartBoundary = md5(mt_rand());
+ self::$multipartBoundary = md5((string)mt_rand());
}
return self::$multipartBoundary;
}
@@ -76,7 +73,7 @@ class OC_Files {
* @param string $name
* @param array $rangeArray ('from'=>int,'to'=>int), ...
*/
- private static function sendHeaders($filename, $name, array $rangeArray) {
+ private static function sendHeaders($filename, $name, array $rangeArray): void {
OC_Response::setContentDispositionHeader($name, 'attachment');
header('Content-Transfer-Encoding: binary', true);
header('Pragma: public');// enable caching in IE
@@ -247,10 +244,10 @@ class OC_Files {
/**
* @param string $rangeHeaderPos
- * @param int $fileSize
+ * @param int|float $fileSize
* @return array $rangeArray ('from'=>int,'to'=>int), ...
*/
- private static function parseHttpRangeHeader($rangeHeaderPos, $fileSize) {
+ private static function parseHttpRangeHeader($rangeHeaderPos, $fileSize): array {
$rArray = explode(',', $rangeHeaderPos);
$minOffset = 0;
$ind = 0;
diff --git a/lib/public/Files/Node.php b/lib/public/Files/Node.php
index b892d8e0a73..b49b4a0f83d 100644
--- a/lib/public/Files/Node.php
+++ b/lib/public/Files/Node.php
@@ -145,7 +145,7 @@ interface Node extends FileInfo {
* Get the size of the file or folder in bytes
*
* @param bool $includeMounts
- * @return int
+ * @return int|float
* @throws InvalidPathException
* @throws NotFoundException
* @since 6.0.0
diff --git a/lib/public/Files/SimpleFS/ISimpleFile.php b/lib/public/Files/SimpleFS/ISimpleFile.php
index 9050fe770b9..e55261497be 100644
--- a/lib/public/Files/SimpleFS/ISimpleFile.php
+++ b/lib/public/Files/SimpleFS/ISimpleFile.php
@@ -49,7 +49,7 @@ interface ISimpleFile {
*
* @since 11.0.0
*/
- public function getSize(): int;
+ public function getSize(): int|float;
/**
* Get the ETag
diff --git a/lib/public/Files/SimpleFS/InMemoryFile.php b/lib/public/Files/SimpleFS/InMemoryFile.php
index 393449d4f1f..ace9bef465a 100644
--- a/lib/public/Files/SimpleFS/InMemoryFile.php
+++ b/lib/public/Files/SimpleFS/InMemoryFile.php
@@ -68,7 +68,7 @@ class InMemoryFile implements ISimpleFile {
* @inheritdoc
* @since 16.0.0
*/
- public function getSize(): int {
+ public function getSize(): int|float {
return strlen($this->contents);
}