Skip to content

Commit

Permalink
expose default-limit to capabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasKaminsky committed Nov 13, 2024
1 parent e8f0141 commit af99dd6
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/Capabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,28 @@
* SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

namespace OCA\Files_DownloadLimit;

use OCA\Files_DownloadLimit\AppInfo\Application;
use OCP\Capabilities\ICapability;
use OCP\IAppConfig;

class Capabilities implements ICapability {

public function __construct(
private readonly IAppConfig $config
) {
}

/**
* @return array{downloadlimit: array{enabled: true}}

Check failure on line 24 in lib/Capabilities.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis

InvalidReturnType

lib/Capabilities.php:24:13: InvalidReturnType: The declared return type 'array{downloadlimit: array{enabled: true}}' for OCA\Files_DownloadLimit\Capabilities::getCapabilities is incorrect, got 'array{downloadlimit: array{'default-limit': int, enabled: true}}' which is different due to additional array shape fields (default-limit) (see https://psalm.dev/011)
*/
public function getCapabilities(): array {
return [

Check failure on line 27 in lib/Capabilities.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis

InvalidReturnStatement

lib/Capabilities.php:27:10: InvalidReturnStatement: The inferred type 'array{downloadlimit: array{'default-limit': int, enabled: true}}' does not match the declared return type 'array{downloadlimit: array{enabled: true}}' for OCA\Files_DownloadLimit\Capabilities::getCapabilities due to additional array shape fields (default-limit) (see https://psalm.dev/128)
'downloadlimit' => [
'enabled' => true
'enabled' => true,
'default-limit' => $this->config->getValueInt(Application::APP_ID, 'default-download-limit', -1),
]
];
}
Expand Down

0 comments on commit af99dd6

Please sign in to comment.