Skip to content

Commit

Permalink
fixup! fixup! fixup! Fix return type of methods returning false on error
Browse files Browse the repository at this point in the history
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
  • Loading branch information
come-nc committed Mar 14, 2023
1 parent 7bfa7ab commit 2cc56d8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
5 changes: 1 addition & 4 deletions lib/private/Files/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -420,11 +420,8 @@ public static function mount($class, $arguments, $mountpoint) {
* 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);
}

Expand Down
16 changes: 4 additions & 12 deletions lib/private/Files/Storage/LocalTempFileTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,10 @@
* 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);
}
Expand All @@ -56,11 +52,7 @@ protected function removeCachedFile($path) {
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;
Expand Down

0 comments on commit 2cc56d8

Please sign in to comment.