Fix psalm errors

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
pull/36120/head
Côme Chilliet 1 year ago
parent db80ac02b0
commit 028c225d96
No known key found for this signature in database
GPG Key ID: A3E2F658B28C760A

@ -138,7 +138,7 @@ class File extends Node implements IFile {
public function put($data) {
try {
$exists = $this->fileView->file_exists($this->path);
if ($this->info && $exists && !$this->info->isUpdateable()) {
if ($exists && !$this->info->isUpdateable()) {
throw new Forbidden();
}
} catch (StorageNotAvailableException $e) {
@ -759,9 +759,6 @@ class File extends Node implements IFile {
* @return string|null
*/
public function getChecksum() {
if (!$this->info) {
return null;
}
return $this->info->getChecksum();
}

@ -49,7 +49,7 @@ use OCP\Share\IManager;
abstract class Node implements \Sabre\DAV\INode {
/**
* @var \OC\Files\View
* @var View
*/
protected $fileView;
@ -100,8 +100,12 @@ abstract class Node implements \Sabre\DAV\INode {
}
}
protected function refreshInfo() {
$this->info = $this->fileView->getFileInfo($this->path);
protected function refreshInfo(): void {
$info = $this->fileView->getFileInfo($this->path);
if ($info === false) {
throw new \Sabre\DAV\Exception('Failed to get fileinfo for '. $this->path);
}
$this->info = $info;
$root = \OC::$server->get(IRootFolder::class);
if ($this->info->getType() === FileInfo::TYPE_FOLDER) {
$this->node = new Folder($root, $this->fileView, $this->path, $this->info);

@ -730,7 +730,7 @@ class Filesystem {
* get the filesystem info
*
* @param string $path
* @param boolean $includeMountPoints whether to add mountpoint sizes,
* @param bool|string $includeMountPoints whether to add mountpoint sizes,
* defaults to true
* @return \OC\Files\FileInfo|false False if file does not exist
*/

@ -1372,9 +1372,8 @@ class View {
* get the filesystem info
*
* @param string $path
* @param boolean|string $includeMountPoints true to add mountpoint sizes,
* @param bool|string $includeMountPoints true to add mountpoint sizes,
* 'ext' to add only ext storage mount point sizes. Defaults to true.
* defaults to true
* @return \OC\Files\FileInfo|false False if file does not exist
*/
public function getFileInfo($path, $includeMountPoints = true) {

Loading…
Cancel
Save