]> source.dussan.org Git - nextcloud-server.git/commitdiff
Ensure that FileInfo return values as required by its phpdoc.
authorPiotr M <mrow4a@yahoo.com>
Tue, 14 Mar 2017 23:59:48 +0000 (00:59 +0100)
committerMorris Jobke <hey@morrisjobke.de>
Thu, 23 Mar 2017 02:03:46 +0000 (20:03 -0600)
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
lib/private/Files/FileInfo.php

index 3ad2932e597b1ca432666f59a895678f6bb89e46..a0a3b0a782a139c1306f008642ca5fd76cab2295 100644 (file)
@@ -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);
        }
 
        /**