mirror of
https://github.com/nextcloud/server.git
synced 2026-06-11 09:42:09 -04:00
Additional type hinting found by psalm
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
This commit is contained in:
parent
94a0b27000
commit
732badf552
8 changed files with 27 additions and 17 deletions
|
|
@ -34,6 +34,7 @@ use OCA\Files_External\Lib\StorageConfig;
|
|||
use OCA\Files_External\Service\BackendService;
|
||||
use OCA\Files_External\Service\GlobalStoragesService;
|
||||
use OCA\Files_External\Service\UserStoragesService;
|
||||
use OCA\Files_External\Service\StoragesService;
|
||||
use OCP\IUserManager;
|
||||
use OCP\IUserSession;
|
||||
use Symfony\Component\Console\Input\ArrayInput;
|
||||
|
|
@ -104,7 +105,7 @@ class Create extends Base {
|
|||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int {
|
||||
$user = (string) $input->getOption('user');
|
||||
$user = (string)$input->getOption('user');
|
||||
$mountPoint = $input->getArgument('mount_point');
|
||||
$storageIdentifier = $input->getArgument('storage_backend');
|
||||
$authIdentifier = $input->getArgument('authentication_backend');
|
||||
|
|
@ -172,7 +173,7 @@ class Create extends Base {
|
|||
return 0;
|
||||
}
|
||||
|
||||
private function validateParam($key, &$value, Backend $storageBackend, AuthMechanism $authBackend): bool {
|
||||
private function validateParam(string $key, &$value, Backend $storageBackend, AuthMechanism $authBackend): bool {
|
||||
$params = array_merge($storageBackend->getParameters(), $authBackend->getParameters());
|
||||
foreach ($params as $param) {
|
||||
/** @var DefinitionParameter $param */
|
||||
|
|
@ -186,7 +187,7 @@ class Create extends Base {
|
|||
return false;
|
||||
}
|
||||
|
||||
private function showMount($user, StorageConfig $mount, InputInterface $input, OutputInterface $output): void {
|
||||
private function showMount(string $user, StorageConfig $mount, InputInterface $input, OutputInterface $output): void {
|
||||
$listCommand = new ListCommand($this->globalService, $this->userService, $this->userSession, $this->userManager);
|
||||
$listInput = new ArrayInput([], $listCommand->getDefinition());
|
||||
$listInput->setOption('output', $input->getOption('output'));
|
||||
|
|
@ -194,7 +195,7 @@ class Create extends Base {
|
|||
$listCommand->listMounts($user, [$mount], $listInput, $output);
|
||||
}
|
||||
|
||||
protected function getStorageService(string $userId) {
|
||||
protected function getStorageService(string $userId): StoragesService {
|
||||
if (!empty($userId)) {
|
||||
$user = $this->userManager->get($userId);
|
||||
if (is_null($user)) {
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ use OCA\Files_External\Lib\StorageModifierTrait;
|
|||
use OCA\Files_External\Lib\VisibilityTrait;
|
||||
use OCA\Files_External\Lib\IIdentifier;
|
||||
use OCA\Files_External\Lib\IFrontendDefinition;
|
||||
use OCP\Files\Storage\IStorage;
|
||||
|
||||
/**
|
||||
* Storage backend
|
||||
|
|
@ -75,7 +76,7 @@ class Backend implements \JsonSerializable, IIdentifier, IFrontendDefinition {
|
|||
private $legacyAuthMechanism;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @return class-string<IStorage>
|
||||
*/
|
||||
public function getStorageClass() {
|
||||
return $this->storageClass;
|
||||
|
|
|
|||
|
|
@ -21,13 +21,15 @@
|
|||
*/
|
||||
namespace OCA\Files_External\Lib;
|
||||
|
||||
use OCP\Files\Storage\IStorage;
|
||||
|
||||
/**
|
||||
* Polyfill for checking dependencies using legacy Storage::checkDependencies()
|
||||
*/
|
||||
trait LegacyDependencyCheckPolyfill {
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @return class-string<IStorage>
|
||||
*/
|
||||
abstract public function getStorageClass();
|
||||
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
|
|||
/** @var ICacheFactory $cacheFactory */
|
||||
$cacheFactory = Server::get(ICacheFactory::class);
|
||||
$this->memCache = $cacheFactory->createLocal('s3-external');
|
||||
$this->logger = \OCP\Server::get(LoggerInterface::class);
|
||||
$this->logger = Server::get(LoggerInterface::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -126,17 +126,17 @@ class StorageConfig implements \JsonSerializable {
|
|||
/**
|
||||
* Creates a storage config
|
||||
*
|
||||
* @param int|null $id config id or null for a new config
|
||||
* @param int|string $id config id or null for a new config
|
||||
*/
|
||||
public function __construct($id = null) {
|
||||
$this->id = $id;
|
||||
$this->id = $id ?? -1;
|
||||
$this->mountOptions['enable_sharing'] = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the configuration id
|
||||
*
|
||||
* @return int
|
||||
* @retun int
|
||||
*/
|
||||
public function getId() {
|
||||
return $this->id;
|
||||
|
|
@ -147,7 +147,7 @@ class StorageConfig implements \JsonSerializable {
|
|||
*
|
||||
* @param int $id configuration id
|
||||
*/
|
||||
public function setId($id) {
|
||||
public function setId(int $id): void {
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -64,11 +64,7 @@ class DBConfigService {
|
|||
$this->crypto = $crypto;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $mountId
|
||||
* @return array
|
||||
*/
|
||||
public function getMountById($mountId) {
|
||||
public function getMountById(int $mountId): ?array {
|
||||
$builder = $this->connection->getQueryBuilder();
|
||||
$query = $builder->select(['mount_id', 'mount_point', 'storage_backend', 'auth_backend', 'priority', 'type'])
|
||||
->from('external_mounts', 'm')
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
<?php
|
||||
use \OCA\Files_External\Lib\Backend\Backend;
|
||||
use \OCA\Files_External\Lib\Backend\Backend;
|
||||
use \OCA\Files_External\Lib\Auth\AuthMechanism;
|
||||
use \OCA\Files_External\Lib\DefinitionParameter;
|
||||
use \OCA\Files_External\Service\BackendService;
|
||||
|
||||
/** @var array $_ */
|
||||
|
||||
$canCreateMounts = $_['visibilityType'] === BackendService::VISIBILITY_ADMIN || $_['allowUserMounting'];
|
||||
|
||||
$l->t("Enable encryption");
|
||||
|
|
|
|||
|
|
@ -1104,6 +1104,14 @@
|
|||
<code>test</code>
|
||||
</TooManyArguments>
|
||||
</file>
|
||||
<file src="apps/files_external/lib/Service/BackendService.php">
|
||||
<TooManyArguments occurrences="1">
|
||||
<code>dispatch</code>
|
||||
</TooManyArguments>
|
||||
<InvalidArgument occurrences="1">
|
||||
<code>dispatch</code>
|
||||
</InvalidArgument>
|
||||
</file>
|
||||
<file src="apps/files_sharing/lib/AppInfo/Application.php">
|
||||
<InvalidArgument occurrences="6">
|
||||
<code>addServiceListener</code>
|
||||
|
|
|
|||
Loading…
Reference in a new issue