Skip to content
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
9 changes: 8 additions & 1 deletion lib/Storage/DirMask.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@ class DirMask extends PermissionsMask {
private readonly int $pathLength;

/**
* @param array $parameters ['storage' => $storage, 'mask' => $mask, 'path' => $path]
* @var int the permissions bits we want to keep
*/
private $mask;

/**
* @param array{storage: \OCP\Files\Storage\IStorage, mask: int, path: string, ...} $parameters
* @psalm-suppress MoreSpecificImplementedParamType
Comment on lines +40 to +41

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param array{storage: \OCP\Files\Storage\IStorage, mask: int, path: string, ...} $parameters
* @psalm-suppress MoreSpecificImplementedParamType
* @param array{storage: \OC\Files\Storage\Storage, mask: int, path: string} $parameters

I think this is correct?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sadly not, psalm will complain that the argument expected are more restrictive than that is written in the base storage wrapper which is just an array.

I don't see a good way around that

*
* $storage: The storage the permissions mask should be applied on
* $mask: The permission bits that should be kept, a combination of the \OCP\Constant::PERMISSION_ constants
Expand All @@ -42,6 +48,7 @@ public function __construct($parameters) {
parent::__construct($parameters);
$this->path = rtrim((string)$parameters['path'], '/');
$this->pathLength = strlen((string)$parameters['path']);
$this->mask = $parameters['mask'];
}

protected function checkPath(string $path): bool {
Expand Down
Loading