diff --git a/apps/workflowengine/lib/Check/FileMimeType.php b/apps/workflowengine/lib/Check/FileMimeType.php
index 1beb87d7a15bb..1878ee0a6b423 100644
--- a/apps/workflowengine/lib/Check/FileMimeType.php
+++ b/apps/workflowengine/lib/Check/FileMimeType.php
@@ -123,6 +123,7 @@ protected function getActualValue() {
}
if ($this->storage->file_exists($this->path) && $this->storage->filesize($this->path)) {
+ /** @var string */
$path = $this->storage->getLocalFile($this->path);
$mimeType = $this->mimeTypeDetector->detectContent($path);
return $this->cacheAndReturnMimeType($this->storage->getId(), $this->path, $mimeType);
diff --git a/build/psalm-baseline.xml b/build/psalm-baseline.xml
index dc2726c7c37b2..8dbde0f515c4d 100644
--- a/build/psalm-baseline.xml
+++ b/build/psalm-baseline.xml
@@ -625,11 +625,6 @@
\Sabre\Uri\split($principal)
-
-
- 'DummyBasic realm="' . $this->realm . '"'
-
-
bool
@@ -1237,7 +1232,7 @@
string
-
+
$id
$id
$id
@@ -1546,10 +1541,6 @@
-
- false
- false
-
$this->handle
$this->handle
@@ -1568,11 +1559,6 @@
-
- false
- false
- false
-
$this->handle
$this->handle
@@ -1591,9 +1577,6 @@
-
- false
-
$files
@@ -1889,12 +1872,8 @@
-
+
$this->sourceRootInfo
- false
- false
- false
- $this->nonMaskedStorage->fopen($this->getUnjailedPath($path), $mode)
ICacheEntry
@@ -2406,8 +2385,7 @@
$cookie
-
- !isset($ldapName[0]) && empty($ldapName[0])
+
is_null($limit)
!is_null($limit) && (int)$this->connection->ldapPagingSize !== 0
is_array($result)
@@ -2691,11 +2669,6 @@
-
-
- string|null
-
-
null
@@ -4487,7 +4460,6 @@
$helper->getFileSize($fullPath)
- file_put_contents($this->getSourcePath($path), $data)
$space
@@ -4553,29 +4525,6 @@
-
- $this->storage->opendir($this->findPathToUse($path))
- $this->storage->stat($this->findPathToUse($path))
- $this->storage->filesize($this->findPathToUse($path))
- $this->storage->filemtime($this->findPathToUse($path))
- $this->storage->file_get_contents($this->findPathToUse($path))
- $result
- $this->storage->getMimeType($this->findPathToUse($path))
- $this->storage->hash($type, $this->findPathToUse($path), $raw)
- $this->storage->free_space($this->findPathToUse($path))
- $this->storage->search($query)
- $this->storage->getLocalFile($this->findPathToUse($path))
- $this->storage->getETag($this->findPathToUse($path))
-
-
- bool
-
-
- $this->storage->filetype($this->findPathToUse($path))
-
-
- bool
-
$this->namesCache
$this->namesCache
@@ -4593,16 +4542,9 @@
-
- $this->storage->filesize($path)
+
false
- $this->storage->file_get_contents($path)
- $this->storage->getLocalFile($path)
- $stat
-
- resource|bool
-
$source
$target
@@ -4630,23 +4572,6 @@
-
- $this->getWrapperStorage()->opendir($this->getUnjailedPath($path))
- $this->getWrapperStorage()->stat($this->getUnjailedPath($path))
- $this->getWrapperStorage()->filesize($this->getUnjailedPath($path))
- $this->getWrapperStorage()->filemtime($this->getUnjailedPath($path))
- $this->getWrapperStorage()->file_get_contents($this->getUnjailedPath($path))
- $this->getWrapperStorage()->fopen($this->getUnjailedPath($path), $mode)
- $this->getWrapperStorage()->getMimeType($this->getUnjailedPath($path))
- $this->getWrapperStorage()->hash($type, $this->getUnjailedPath($path), $raw)
- $this->getWrapperStorage()->free_space($this->getUnjailedPath($path))
- $this->getWrapperStorage()->search($query)
- $this->getWrapperStorage()->getLocalFile($this->getUnjailedPath($path))
- $this->getWrapperStorage()->getETag($this->getUnjailedPath($path))
-
-
- bool
-
$this->getWrapperStorage()->filetype($this->getUnjailedPath($path))
@@ -4654,16 +4579,7 @@
bool
-
-
- $this->checkMask($permissions) ? parent::fopen($path, $mode) : false
-
-
-
- $this->storage->free_space($path)
- $source
-
$extension === 'part'
@@ -4682,39 +4598,14 @@
-
- $this->getWrapperStorage()->opendir($path)
- $this->getWrapperStorage()->stat($path)
- $this->getWrapperStorage()->filesize($path)
- $this->getWrapperStorage()->filemtime($path)
- $this->getWrapperStorage()->file_get_contents($path)
- $this->getWrapperStorage()->fopen($path, $mode)
- $this->getWrapperStorage()->getMimeType($path)
- $this->getWrapperStorage()->hash($type, $path, $raw)
- $this->getWrapperStorage()->free_space($path)
- $this->getWrapperStorage()->search($query)
- $this->getWrapperStorage()->getLocalFile($path)
- $this->getWrapperStorage()->getETag($path)
- $this->getWrapperStorage()->getDirectDownload($path)
-
-
- bool
-
-
- $this->getWrapperStorage()->filetype($path)
+
$this->getWrapperStorage()->test()
-
- bool
+
true
-
- false
- false
- false
-
$this->current
$this->current
@@ -5041,11 +4932,6 @@
mixed
-
-
- $lockingCacheClass && class_exists($distributedCacheClass) && $lockingCacheClass::isAvailable()
-
-
method_exists(self::$cache, 'deleteMulti')
@@ -5149,11 +5035,6 @@
?IImage
-
-
- $file->getStorage()->getLocalFile($file->getInternalPath())
-
-
$svg
@@ -6039,18 +5920,10 @@
\OC_App::getStorage($app)
-
-
- string|false
-
-
array
-
- string|false
-
diff --git a/lib/private/Archive/Archive.php b/lib/private/Archive/Archive.php
index ee27009ca8348..f0b62deb04878 100644
--- a/lib/private/Archive/Archive.php
+++ b/lib/private/Archive/Archive.php
@@ -113,7 +113,7 @@ abstract public function remove($path);
* get a file handler
* @param string $path
* @param string $mode
- * @return resource
+ * @return bool|resource
*/
abstract public function getStream($path, $mode);
/**
diff --git a/lib/private/Archive/TAR.php b/lib/private/Archive/TAR.php
index 0d4103299ced7..a3734f895fefe 100644
--- a/lib/private/Archive/TAR.php
+++ b/lib/private/Archive/TAR.php
@@ -338,7 +338,7 @@ public function remove($path) {
*
* @param string $path
* @param string $mode
- * @return resource
+ * @return bool|resource
*/
public function getStream($path, $mode) {
if (strrpos($path, '.') !== false) {
diff --git a/lib/private/Archive/ZIP.php b/lib/private/Archive/ZIP.php
index 31aea420a3dfe..3b132e81bf448 100644
--- a/lib/private/Archive/ZIP.php
+++ b/lib/private/Archive/ZIP.php
@@ -187,7 +187,7 @@ public function remove($path) {
* get a file handler
* @param string $path
* @param string $mode
- * @return resource
+ * @return bool|resource
*/
public function getStream($path, $mode) {
if ($mode=='r' or $mode=='rb') {
diff --git a/lib/private/Files/Storage/Wrapper/Encryption.php b/lib/private/Files/Storage/Wrapper/Encryption.php
index b12e11576ddc8..849f80906a8d6 100644
--- a/lib/private/Files/Storage/Wrapper/Encryption.php
+++ b/lib/private/Files/Storage/Wrapper/Encryption.php
@@ -136,7 +136,7 @@ public function __construct(
* The result for filesize when called on a folder is required to be 0
*
* @param string $path
- * @return int
+ * @return int|bool
*/
public function filesize($path) {
$fullPath = $this->getFullPath($path);
@@ -209,7 +209,7 @@ public function getDirectoryContent($directory): \Traversable {
* see http://php.net/manual/en/function.file_get_contents.php
*
* @param string $path
- * @return string
+ * @return string|bool
*/
public function file_get_contents($path) {
$encryptionModule = $this->getEncryptionModule($path);
@@ -401,7 +401,9 @@ public function fopen($path, $mode) {
}
if ($this->file_exists($path)) {
+ /** @var int */
$size = $this->storage->filesize($path);
+ /** @var int */
$unencryptedSize = $this->filesize($path);
} else {
$size = $unencryptedSize = 0;
@@ -498,7 +500,7 @@ protected function verifyUnencryptedSize($path, $unencryptedSize) {
if (isset($this->fixUnencryptedSizeOf[$this->getFullPath($path)]) === false) {
$this->fixUnencryptedSizeOf[$this->getFullPath($path)] = true;
try {
- $result = $this->fixUnencryptedSize($path, $size, $unencryptedSize);
+ $result = $this->fixUnencryptedSize($path, (int) $size, $unencryptedSize);
} catch (\Exception $e) {
$this->logger->error('Couldn\'t re-calculate unencrypted size for ' . $path);
$this->logger->logException($e);
@@ -760,7 +762,7 @@ private function copyBetweenStorage(Storage\IStorage $sourceStorage, $sourceInte
}
if ($result) {
if ($preserveMtime) {
- $this->touch($targetInternalPath, $sourceStorage->filemtime($sourceInternalPath));
+ $this->touch($targetInternalPath, (int) $sourceStorage->filemtime($sourceInternalPath));
}
$this->updateEncryptedVersion($sourceStorage, $sourceInternalPath, $targetInternalPath, $isRename, false);
} else {
@@ -778,7 +780,7 @@ private function copyBetweenStorage(Storage\IStorage $sourceStorage, $sourceInte
* The local version of the file can be temporary and doesn't have to be persistent across requests
*
* @param string $path
- * @return string
+ * @return bool|string
*/
public function getLocalFile($path) {
if ($this->encryptionManager->isEnabled()) {
@@ -807,7 +809,7 @@ public function isLocal() {
* only the following keys are required in the result: size and mtime
*
* @param string $path
- * @return array
+ * @return array|bool
*/
public function stat($path) {
$stat = $this->storage->stat($path);
diff --git a/lib/private/Files/Stream/Encryption.php b/lib/private/Files/Stream/Encryption.php
index 2708ea6a7c324..36211677140b5 100644
--- a/lib/private/Files/Stream/Encryption.php
+++ b/lib/private/Files/Stream/Encryption.php
@@ -524,7 +524,7 @@ protected function readCache() {
/**
* write header at beginning of encrypted file
*
- * @return integer
+ * @return int|false
* @throws EncryptionHeaderKeyExistsException if header key is already in use
*/
protected function writeHeader() {
diff --git a/lib/private/Preview/ProviderV2.php b/lib/private/Preview/ProviderV2.php
index ae2c678d66db6..1a16e1f5e427d 100644
--- a/lib/private/Preview/ProviderV2.php
+++ b/lib/private/Preview/ProviderV2.php
@@ -96,6 +96,7 @@ protected function getLocalFile(File $file, int $maxSize = null): string {
$this->tmpFiles[] = $absPath;
return $absPath;
} else {
+ /** @var string */
return $file->getStorage()->getLocalFile($file->getInternalPath());
}
}
diff --git a/lib/public/Files/Storage.php b/lib/public/Files/Storage.php
index 9438dedfb13d6..2245bea57ba17 100644
--- a/lib/public/Files/Storage.php
+++ b/lib/public/Files/Storage.php
@@ -330,7 +330,7 @@ public function touch($path, $mtime = null);
* The local version of the file can be temporary and doesn't have to be persistent across requests
*
* @param string $path
- * @return string|bool
+ * @return bool|string
* @since 6.0.0
*/
public function getLocalFile($path);