diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2023-03-13 18:59:16 +0100 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2023-04-03 10:52:34 +0200 |
commit | ea05544213b6d472338684e9c7bae66f68453c58 (patch) | |
tree | 809724b54187a4d21fbe967b38b10fc4cb4ca38a /lib/private/Files/Storage | |
parent | f974281ac9a086004c7e971f3585ed8aa21d194d (diff) | |
download | nextcloud-server-ea05544213b6d472338684e9c7bae66f68453c58.tar.gz nextcloud-server-ea05544213b6d472338684e9c7bae66f68453c58.zip |
Fix return type of methods returning false on error
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'lib/private/Files/Storage')
5 files changed, 14 insertions, 22 deletions
diff --git a/lib/private/Files/Storage/LocalTempFileTrait.php b/lib/private/Files/Storage/LocalTempFileTrait.php index 2ac0a74b692..314e38cb277 100644 --- a/lib/private/Files/Storage/LocalTempFileTrait.php +++ b/lib/private/Files/Storage/LocalTempFileTrait.php @@ -35,14 +35,10 @@ namespace OC\Files\Storage; * in classes which extend it, e.g. $this->stat() . */ trait LocalTempFileTrait { - /** @var string[] */ - protected $cachedFiles = []; + /** @var array<string,string|false> */ + protected array $cachedFiles = []; - /** - * @param string $path - * @return string - */ - protected function getCachedFile($path) { + protected function getCachedFile(string $path): string|false { if (!isset($this->cachedFiles[$path])) { $this->cachedFiles[$path] = $this->toTmpFile($path); } @@ -56,11 +52,7 @@ trait LocalTempFileTrait { unset($this->cachedFiles[$path]); } - /** - * @param string $path - * @return string - */ - protected function toTmpFile($path) { //no longer in the storage api, still useful here + protected function toTmpFile(string $path): string|false { //no longer in the storage api, still useful here $source = $this->fopen($path, 'r'); if (!$source) { return false; diff --git a/lib/private/Files/Storage/Wrapper/Encoding.php b/lib/private/Files/Storage/Wrapper/Encoding.php index d6006f746ad..dd699993e84 100644 --- a/lib/private/Files/Storage/Wrapper/Encoding.php +++ b/lib/private/Files/Storage/Wrapper/Encoding.php @@ -159,7 +159,7 @@ class Encoding extends Wrapper { * see https://www.php.net/manual/en/function.opendir.php * * @param string $path - * @return resource|bool + * @return resource|false */ public function opendir($path) { $handle = $this->storage->opendir($this->findPathToUse($path)); @@ -429,7 +429,7 @@ class Encoding extends Wrapper { * 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 string|false */ public function getLocalFile($path) { return $this->storage->getLocalFile($this->findPathToUse($path)); @@ -481,7 +481,7 @@ class Encoding extends Wrapper { * get the ETag for a file or folder * * @param string $path - * @return string|bool + * @return string|false */ public function getETag($path) { return $this->storage->getETag($this->findPathToUse($path)); diff --git a/lib/private/Files/Storage/Wrapper/EncodingDirectoryWrapper.php b/lib/private/Files/Storage/Wrapper/EncodingDirectoryWrapper.php index fd0d2707f8d..3cda399f22d 100644 --- a/lib/private/Files/Storage/Wrapper/EncodingDirectoryWrapper.php +++ b/lib/private/Files/Storage/Wrapper/EncodingDirectoryWrapper.php @@ -46,7 +46,7 @@ class EncodingDirectoryWrapper extends DirectoryWrapper { /** * @param resource $source * @param callable $filter - * @return resource|bool + * @return resource|false */ public static function wrap($source) { return self::wrapSource($source, [ diff --git a/lib/private/Files/Storage/Wrapper/Jail.php b/lib/private/Files/Storage/Wrapper/Jail.php index e21a2cba244..619d8b07137 100644 --- a/lib/private/Files/Storage/Wrapper/Jail.php +++ b/lib/private/Files/Storage/Wrapper/Jail.php @@ -108,7 +108,7 @@ class Jail extends Wrapper { * see https://www.php.net/manual/en/function.opendir.php * * @param string $path - * @return resource|bool + * @return resource|false */ public function opendir($path) { return $this->getWrapperStorage()->opendir($this->getUnjailedPath($path)); @@ -368,7 +368,7 @@ class Jail extends Wrapper { * 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 string|false */ public function getLocalFile($path) { return $this->getWrapperStorage()->getLocalFile($this->getUnjailedPath($path)); @@ -431,7 +431,7 @@ class Jail extends Wrapper { * get the ETag for a file or folder * * @param string $path - * @return string|bool + * @return string|false */ public function getETag($path) { return $this->getWrapperStorage()->getETag($this->getUnjailedPath($path)); diff --git a/lib/private/Files/Storage/Wrapper/Wrapper.php b/lib/private/Files/Storage/Wrapper/Wrapper.php index c2d382f5dfc..28a1e0b1e4d 100644 --- a/lib/private/Files/Storage/Wrapper/Wrapper.php +++ b/lib/private/Files/Storage/Wrapper/Wrapper.php @@ -98,7 +98,7 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea * see https://www.php.net/manual/en/function.opendir.php * * @param string $path - * @return resource|bool + * @return resource|false */ public function opendir($path) { return $this->getWrapperStorage()->opendir($path); @@ -358,7 +358,7 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea * 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 string|false */ public function getLocalFile($path) { return $this->getWrapperStorage()->getLocalFile($path); @@ -456,7 +456,7 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea * get the ETag for a file or folder * * @param string $path - * @return string|bool + * @return string|false */ public function getETag($path) { return $this->getWrapperStorage()->getETag($path); |