diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2023-01-30 16:15:45 +0100 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2023-02-07 11:23:34 +0100 |
commit | 1765908c0366ce1ff65004473d57e4be724fac95 (patch) | |
tree | ec422e001289aa3d289b65356300801793e8e3d2 | |
parent | 33b52077ffed16c265eb6fb3c1e2dff3102aa511 (diff) | |
download | nextcloud-server-1765908c0366ce1ff65004473d57e4be724fac95.tar.gz nextcloud-server-1765908c0366ce1ff65004473d57e4be724fac95.zip |
Document that size may be a float in new class VersionEntity
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
-rw-r--r-- | apps/files_versions/lib/Db/VersionEntity.php | 6 | ||||
-rw-r--r-- | apps/files_versions/lib/Sabre/VersionFile.php | 6 | ||||
-rw-r--r-- | apps/files_versions/lib/Versions/IVersion.php | 4 | ||||
-rw-r--r-- | apps/files_versions/lib/Versions/Version.php | 6 |
4 files changed, 13 insertions, 9 deletions
diff --git a/apps/files_versions/lib/Db/VersionEntity.php b/apps/files_versions/lib/Db/VersionEntity.php index d5adbcfa104..a37171ef93f 100644 --- a/apps/files_versions/lib/Db/VersionEntity.php +++ b/apps/files_versions/lib/Db/VersionEntity.php @@ -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 +} diff --git a/apps/files_versions/lib/Sabre/VersionFile.php b/apps/files_versions/lib/Sabre/VersionFile.php index 20ae25a7623..8fd97b0636f 100644 --- a/apps/files_versions/lib/Sabre/VersionFile.php +++ b/apps/files_versions/lib/Sabre/VersionFile.php @@ -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(); } diff --git a/apps/files_versions/lib/Versions/IVersion.php b/apps/files_versions/lib/Versions/IVersion.php index 8ab3357b1e2..8480658fa30 100644 --- a/apps/files_versions/lib/Versions/IVersion.php +++ b/apps/files_versions/lib/Versions/IVersion.php @@ -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 diff --git a/apps/files_versions/lib/Versions/Version.php b/apps/files_versions/lib/Versions/Version.php index e87c2a593d7..0dade222abc 100644 --- a/apps/files_versions/lib/Versions/Version.php +++ b/apps/files_versions/lib/Versions/Version.php @@ -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; } |