Skip to content

Commit

Permalink
chore: Add return types of storage wrapper
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Knorr <jus@bitgrid.net>
  • Loading branch information
juliusknorr committed Oct 11, 2024
1 parent f5364be commit d2770ae
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions lib/ACL/ACLStorageWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
namespace OCA\Collectives\ACL;

use OC\Files\Cache\Cache;
use OC\Files\Cache\Scanner;
use OC\Files\Cache\Wrapper\CacheWrapper;
use OC\Files\Storage\Wrapper\Wrapper;
use OCP\Constants;
use OCP\Files\Cache\IScanner;
use Traversable;

class ACLStorageWrapper extends Wrapper {
Expand Down Expand Up @@ -60,7 +60,7 @@ public function isSharable($path): bool {
return $this->checkPermissions(Constants::PERMISSION_SHARE) && parent::isSharable($path);
}

public function getPermissions($path) {
public function getPermissions($path): int {
return $this->storage->getPermissions($path) & $this->permissions;
}

Expand Down Expand Up @@ -110,7 +110,7 @@ public function unlink($path): bool {
return $this->checkPermissions(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;
return $this->checkPermissions($permissions) ? parent::file_put_contents($path, $data) : false;
}
Expand Down Expand Up @@ -147,7 +147,7 @@ public function getMetaData($path): ?array {
return $data;
}

public function getScanner($path = '', $storage = null): Scanner {
public function getScanner($path = '', $storage = null): IScanner {
if (!$storage) {
$storage = $this->storage;
}
Expand All @@ -164,14 +164,14 @@ public function is_file($path): bool {
parent::is_file($path);
}

public function stat($path) {
public function stat($path): array|false {
if (!$this->checkPermissions(Constants::PERMISSION_READ)) {
return false;
}
return parent::stat($path);
}

public function filetype($path) {
public function filetype($path): string|false {
if (!$this->checkPermissions(Constants::PERMISSION_READ)) {
return false;
}
Expand All @@ -182,42 +182,42 @@ public function file_exists($path): bool {
return $this->checkPermissions(Constants::PERMISSION_READ) && parent::file_exists($path);
}

public function filemtime($path) {
public function filemtime($path): int|false {
if (!$this->checkPermissions(Constants::PERMISSION_READ)) {
return false;
}
return parent::filemtime($path);
}

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

public function getMimeType($path) {
public function getMimeType($path): string|false {
if (!$this->checkPermissions(Constants::PERMISSION_READ)) {
return false;
}
return parent::getMimeType($path);
}

public function hash($type, $path, $raw = false) {
public function hash($type, $path, $raw = false): string|false {
if (!$this->checkPermissions(Constants::PERMISSION_READ)) {
return false;
}
return parent::hash($type, $path, $raw);
}

public function getETag($path) {
public function getETag($path): string|false {
if (!$this->checkPermissions(Constants::PERMISSION_READ)) {
return false;
}
return parent::getETag($path);
}

public function getDirectDownload($path) {
public function getDirectDownload($path): array|false {
if (!$this->checkPermissions(Constants::PERMISSION_READ)) {
return false;
}
Expand Down

0 comments on commit d2770ae

Please sign in to comment.