Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(api): return types for Storage\LockWrapper #368

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions lib/Storage/LockWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ protected function isLocked(string $ownerId, string $path, string $viewerId, &$l
}


public function rename($path1, $path2) {
public function rename($path1, $path2): bool {
if (strpos($path1, $path2) === 0) {
$part = substr($path1, strlen($path2));
//This is a rename of the transfer file to the original file
Expand All @@ -149,7 +149,7 @@ public function rename($path1, $path2) {
&& parent::rename($path1, $path2);
}

public function copy($path1, $path2) {
public function copy($path1, $path2): bool {
$permissions =
$this->file_exists($path2) ? Constants::PERMISSION_UPDATE : Constants::PERMISSION_CREATE;

Expand All @@ -160,28 +160,28 @@ public function copy($path1, $path2) {
&& parent::copy($path1, $path2);
}

public function touch($path, $mtime = null) {
public function touch($path, $mtime = null): bool {
$permissions =
$this->file_exists($path) ? Constants::PERMISSION_UPDATE : Constants::PERMISSION_CREATE;

return $this->checkPermissions($path, $permissions) && parent::touch($path, $mtime);
}

public function mkdir($path) {
public function mkdir($path): bool {
return $this->checkPermissions($path, Constants::PERMISSION_CREATE) && parent::mkdir($path);
}

public function rmdir($path) {
public function rmdir($path): bool {
return $this->checkPermissions($path, Constants::PERMISSION_DELETE)
&& parent::rmdir($path);
}

public function unlink($path) {
public function unlink($path): bool {
return $this->checkPermissions($path, Constants::PERMISSION_DELETE)
&& parent::unlink($path);
}

public function file_put_contents($path, $data) {
public function file_put_contents($path, $data): int|float|false {
$permissions =
$this->file_exists($path) ? Constants::PERMISSION_UPDATE : Constants::PERMISSION_CREATE;

Expand All @@ -206,7 +206,7 @@ public function writeStream(string $path, $stream, ?int $size = null): int {
return $this->checkPermissions($path, $permissions) ? parent::writeStream($path, $stream, $size) : 0;
}

public function file_get_contents($path) {
public function file_get_contents($path): string|false {
if (!$this->checkPermissions($path, Constants::PERMISSION_READ)) {
return false;
}
Expand Down
Loading