Skip to content

Commit

Permalink
Improve typing for fopen/toTmpFile
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 13, 2023
1 parent 09f371b commit 73a0066
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions lib/private/Files/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ public static function tearDown() {
/**
* get the relative path of the root data directory for the current user
*
* @return string
* @return ?string
*
* Returns path like /admin/files
*/
Expand Down Expand Up @@ -584,9 +584,10 @@ public static function fopen($path, $mode) {
}

/**
* @return string
* @param string $path
* @throws \OCP\Files\InvalidPathException
*/
public static function toTmpFile($path) {
public static function toTmpFile($path): string|false {
return self::$defaultInstance->toTmpFile($path);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/private/Files/Node/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function putContent($data) {

/**
* @param string $mode
* @return resource
* @return resource|false
* @throws NotPermittedException
* @throws LockedException
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/public/Files/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function getMimeType();
* Open the file as stream, resulting resource can be operated as stream like the result from php's own fopen
*
* @param string $mode
* @return resource
* @return resource|false
* @throws NotPermittedException
* @throws LockedException
* @since 6.0.0
Expand Down

0 comments on commit 73a0066

Please sign in to comment.