]> source.dussan.org Git - nextcloud-server.git/commitdiff
Document that size may be a float in new class VersionEntity
authorCôme Chilliet <come.chilliet@nextcloud.com>
Mon, 30 Jan 2023 15:15:45 +0000 (16:15 +0100)
committerCôme Chilliet <come.chilliet@nextcloud.com>
Tue, 7 Feb 2023 10:23:34 +0000 (11:23 +0100)
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
apps/files_versions/lib/Db/VersionEntity.php
apps/files_versions/lib/Sabre/VersionFile.php
apps/files_versions/lib/Versions/IVersion.php
apps/files_versions/lib/Versions/Version.php

index d5adbcfa104fa65e110b6cd1cc512141b59d8038..a37171ef93ffe7ccfd1db5f601e3324997270eaa 100644 (file)
@@ -36,8 +36,8 @@ use OCP\DB\Types;
  * @method void setFileId(int $fileId)
  * @method int getTimestamp()
  * @method void setTimestamp(int $timestamp)
- * @method int getSize()
- * @method void setSize(int $size)
+ * @method int|float getSize()
+ * @method void setSize(int|float $size)
  * @method int getMimetype()
  * @method void setMimetype(int $mimetype)
  * @method array|null getMetadata()
@@ -78,4 +78,4 @@ class VersionEntity extends Entity implements JsonSerializable {
                $this->metadata['label'] = $label;
                $this->markFieldUpdated('metadata');
        }
-}
\ No newline at end of file
+}
index 20ae25a762376e97cb2cd1e2621d2d16f65fceba..8fd97b0636f75e1df519db8e7ff2c1eebd026b10 100644 (file)
@@ -68,7 +68,11 @@ class VersionFile implements IFile {
                return (string)$this->version->getRevisionId();
        }
 
-       public function getSize(): int {
+       /**
+        * @psalm-suppress ImplementedReturnTypeMismatch \Sabre\DAV\IFile::getSize signature does not support 32bit
+        * @return int|float
+        */
+       public function getSize(): int|float {
                return $this->version->getSize();
        }
 
index 8ab3357b1e21658f30dfcaaa9b3baa1488f342ab..8480658fa30fca4d18838ba793f584e59cfa6bd7 100644 (file)
@@ -65,10 +65,10 @@ interface IVersion {
        /**
         * Get the size of this version
         *
-        * @return int
+        * @return int|float
         * @since 15.0.0
         */
-       public function getSize(): int;
+       public function getSize(): int|float;
 
        /**
         * Get the name of the source file at the time of making this version
index e87c2a593d791d62899b731c1f50a493d5d15287..0dade222abce1c27a3d0ccc3ab5f01efb4cea0e9 100644 (file)
@@ -40,7 +40,7 @@ class Version implements IVersion, INameableVersion {
 
        private string $label;
 
-       /** @var int */
+       /** @var int|float */
        private $size;
 
        /** @var string */
@@ -62,7 +62,7 @@ class Version implements IVersion, INameableVersion {
                int $timestamp,
                $revisionId,
                string $name,
-               int $size,
+               int|float $size,
                string $mimetype,
                string $path,
                FileInfo $sourceFileInfo,
@@ -98,7 +98,7 @@ class Version implements IVersion, INameableVersion {
                return $this->timestamp;
        }
 
-       public function getSize(): int {
+       public function getSize(): int|float {
                return $this->size;
        }