Merge pull request #4001 from nextcloud/backport-27389
Ensure that FileInfo return values as required by its phpdoc.
This commit is contained in:
commit
eee7e97a6e
|
@ -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']) ? (int) $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']) ? (int) $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 (int) $this->data['mtime'];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -224,11 +226,11 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
|
|||
* @return int
|
||||
*/
|
||||
public function getPermissions() {
|
||||
$perms = $this->data['permissions'];
|
||||
$perms = (int) $this->data['permissions'];
|
||||
if (\OCP\Util::isSharingDisabledForUser() || ($this->isShared() && !\OC\Share\Share::isResharingAllowed())) {
|
||||
$perms = $perms & ~\OCP\Constants::PERMISSION_SHARE;
|
||||
}
|
||||
return $perms;
|
||||
return (int) $perms;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -144,7 +144,7 @@ interface FileInfo {
|
|||
/**
|
||||
* Get the file id of the file or folder
|
||||
*
|
||||
* @return int
|
||||
* @return int|null
|
||||
* @since 7.0.0
|
||||
*/
|
||||
public function getId();
|
||||
|
|
Loading…
Reference in New Issue