From 5c7079f8c67ff1c8153275ff1eb49d04c05fb808 Mon Sep 17 00:00:00 2001 From: Piotr M Date: Wed, 15 Mar 2017 00:59:48 +0100 Subject: [PATCH] Ensure that FileInfo return values as required by its phpdoc. Signed-off-by: Morris Jobke --- lib/private/Files/FileInfo.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/private/Files/FileInfo.php b/lib/private/Files/FileInfo.php index 3ad2932e59..a0a3b0a782 100644 --- a/lib/private/Files/FileInfo.php +++ b/lib/private/Files/FileInfo.php @@ -148,10 +148,12 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { } /** - * @return int + * Get FileInfo ID or null in case of part file + * + * @return int/null */ public function getId() { - return $this->data['fileid']; + return isset($this->data['fileid']) ? intval($this->data['fileid']) : null; } /** @@ -193,7 +195,7 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { */ public function getSize() { $this->updateEntryfromSubMounts(); - return isset($this->data['size']) ? $this->data['size'] : 0; + return isset($this->data['size']) ? intval($this->data['size']) : 0; } /** @@ -201,7 +203,7 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { */ public function getMTime() { $this->updateEntryfromSubMounts(); - return $this->data['mtime']; + return intval($this->data['mtime']); } /** @@ -217,7 +219,7 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { * @return int */ public function getEncryptedVersion() { - return isset($this->data['encryptedVersion']) ? (int) $this->data['encryptedVersion'] : 1; + return isset($this->data['encryptedVersion']) ? intval($this->data['encryptedVersion']) : 1; } /** @@ -228,7 +230,7 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { if (\OCP\Util::isSharingDisabledForUser() || ($this->isShared() && !\OC\Share\Share::isResharingAllowed())) { $perms = $perms & ~\OCP\Constants::PERMISSION_SHARE; } - return $perms; + return intval($perms); } /**