Ensure that FileInfo return values as required by its phpdoc.

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
This commit is contained in:
Piotr M 2017-03-15 00:59:48 +01:00 committed by Morris Jobke
parent d551b8e6fd
commit 5c7079f8c6
No known key found for this signature in database
GPG Key ID: 9CE5ED29E7FCD38A
1 changed files with 8 additions and 6 deletions

View 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);
}
/**