diff options
Diffstat (limited to 'lib/private/Files')
-rw-r--r-- | lib/private/Files/Filesystem.php | 10 | ||||
-rw-r--r-- | lib/private/Files/SimpleFS/NewSimpleFile.php | 2 | ||||
-rw-r--r-- | lib/private/Files/SimpleFS/SimpleFile.php | 2 | ||||
-rw-r--r-- | lib/private/Files/Storage/LocalTempFileTrait.php | 16 | ||||
-rw-r--r-- | lib/private/Files/Storage/Wrapper/Encoding.php | 6 | ||||
-rw-r--r-- | lib/private/Files/Storage/Wrapper/EncodingDirectoryWrapper.php | 2 | ||||
-rw-r--r-- | lib/private/Files/Storage/Wrapper/Jail.php | 6 | ||||
-rw-r--r-- | lib/private/Files/Storage/Wrapper/Wrapper.php | 6 | ||||
-rw-r--r-- | lib/private/Files/View.php | 8 |
9 files changed, 22 insertions, 36 deletions
diff --git a/lib/private/Files/Filesystem.php b/lib/private/Files/Filesystem.php index 74205351e60..367982eed72 100644 --- a/lib/private/Files/Filesystem.php +++ b/lib/private/Files/Filesystem.php @@ -420,11 +420,8 @@ class Filesystem { * return the path to a local version of the file * we need this because we can't know if a file is stored local or not from * outside the filestorage and for some purposes a local file is needed - * - * @param string $path - * @return string */ - public static function getLocalFile($path) { + public static function getLocalFile(string $path): string|false { return self::$defaultInstance->getLocalFile($path); } @@ -761,11 +758,8 @@ class Filesystem { /** * get the ETag for a file or folder - * - * @param string $path - * @return string */ - public static function getETag($path) { + public static function getETag(string $path): string|false { return self::$defaultInstance->getETag($path); } } diff --git a/lib/private/Files/SimpleFS/NewSimpleFile.php b/lib/private/Files/SimpleFS/NewSimpleFile.php index 1d0972bcc54..50511b5a5f9 100644 --- a/lib/private/Files/SimpleFS/NewSimpleFile.php +++ b/lib/private/Files/SimpleFS/NewSimpleFile.php @@ -196,7 +196,7 @@ class NewSimpleFile implements ISimpleFile { /** * Open the file as stream for reading, resulting resource can be operated as stream like the result from php's own fopen * - * @return resource + * @return resource|false * @throws \OCP\Files\NotPermittedException * @since 14.0.0 */ diff --git a/lib/private/Files/SimpleFS/SimpleFile.php b/lib/private/Files/SimpleFS/SimpleFile.php index 95ef332e2f5..76ab06feaab 100644 --- a/lib/private/Files/SimpleFS/SimpleFile.php +++ b/lib/private/Files/SimpleFS/SimpleFile.php @@ -150,7 +150,7 @@ class SimpleFile implements ISimpleFile { /** * Open the file as stream for reading, resulting resource can be operated as stream like the result from php's own fopen * - * @return resource + * @return resource|false * @throws \OCP\Files\NotPermittedException * @since 14.0.0 */ 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); diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php index 4ee44b995b3..fd264a77cba 100644 --- a/lib/private/Files/View.php +++ b/lib/private/Files/View.php @@ -223,7 +223,7 @@ class View { * * @param string $path */ - public function getLocalFile($path): string|bool { + public function getLocalFile($path): string|false { $parent = substr($path, 0, strrpos($path, '/') ?: 0); $path = $this->getAbsolutePath($path); [$storage, $internalPath] = Filesystem::resolvePath($path); @@ -333,7 +333,7 @@ class View { /** * @param string $path - * @return resource + * @return resource|false */ public function opendir($path) { return $this->basicOperation('opendir', $path, ['read']); @@ -1680,14 +1680,14 @@ class View { * get the ETag for a file or folder * * @param string $path - * @return string + * @return string|false */ public function getETag($path) { [$storage, $internalPath] = $this->resolvePath($path); if ($storage) { return $storage->getETag($internalPath); } else { - return null; + return false; } } |