Skip to content

Commit

Permalink
chore: Improve phpdoc typing to silence psalm errors
Browse files Browse the repository at this point in the history
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
  • Loading branch information
come-nc committed Apr 4, 2024
1 parent 4311f60 commit cd53e71
Show file tree
Hide file tree
Showing 15 changed files with 43 additions and 1 deletion.
3 changes: 3 additions & 0 deletions apps/dav/lib/CardDAV/SyncService.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,9 @@ public function getLocalSystemAddressBook() {
return $this->localSystemAddressBook;
}

/**
* @return void
*/
public function syncInstance(?\Closure $progressCallback = null) {
$systemAddressBook = $this->getLocalSystemAddressBook();
$this->userManager->callForAllUsers(function ($user) use ($systemAddressBook, $progressCallback) {
Expand Down
4 changes: 4 additions & 0 deletions apps/dav/lib/Connector/Sabre/Exception/FileLocked.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
use Exception;

class FileLocked extends \Sabre\DAV\Exception {
/**
* @param string $message
* @param int $code
*/
public function __construct($message = "", $code = 0, ?Exception $previous = null) {
if ($previous instanceof \OCP\Files\LockNotAcquiredException) {
$message = sprintf('Target file %s is locked by another process.', $previous->path);
Expand Down
3 changes: 2 additions & 1 deletion apps/dav/lib/Connector/Sabre/FilesPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,8 @@ private function getMetadataFileAccessRight(Node $node, string $userId): int {

/**
* @param string $filePath
* @param \Sabre\DAV\INode $node
* @param ?\Sabre\DAV\INode $node
* @return void
* @throws \Sabre\DAV\Exception\BadRequest
*/
public function sendFileIdHeader($filePath, ?\Sabre\DAV\INode $node = null) {
Expand Down
3 changes: 3 additions & 0 deletions apps/dav/lib/HookManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ public function changeUser($params) {
}
}

/**
* @return void
*/
public function firstLogin(?IUser $user = null) {
if (!is_null($user)) {
$principal = 'principals/users/' . $user->getUID();
Expand Down
3 changes: 3 additions & 0 deletions apps/files_external/lib/Lib/Auth/Password/GlobalAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ public function saveAuth($uid, $user, $password) {
]);
}

/**
* @return void
*/
public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = null) {
if ($storage->getType() === StorageConfig::MOUNT_TYPE_ADMIN) {
$uid = '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ private function getCredentials(IUser $user): array {
return $credentials;
}

/**
* @return void
*/
public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = null) {
if (!isset($user)) {
throw new InsufficientDataForMeaningfulAnswerException('No login credentials saved');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ public function __construct(IL10N $l, CredentialsStore $credentialsStore) {
->addParameters([]);
}

/**
* @return void
*/
public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = null) {
try {
$credentials = $this->credentialsStore->getLoginCredentials();
Expand Down
3 changes: 3 additions & 0 deletions apps/files_external/lib/Lib/Auth/Password/UserGlobalAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ public function saveBackendOptions(IUser $user, $id, $backendOptions) {
$this->credentialsManager->store($user->getUID(), self::CREDENTIALS_IDENTIFIER, $credentials);
}

/**
* @return void
*/
public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = null) {
if ($user === null) {
throw new InsufficientDataForMeaningfulAnswerException('No credentials saved');
Expand Down
3 changes: 3 additions & 0 deletions apps/files_external/lib/Lib/Auth/Password/UserProvided.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ public function saveBackendOptions(IUser $user, $mountId, array $options) {
]);
}

/**
* @return void
*/
public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = null) {
if (!isset($user)) {
throw new InsufficientDataForMeaningfulAnswerException('No credentials saved');
Expand Down
3 changes: 3 additions & 0 deletions apps/files_external/lib/Lib/Auth/PublicKey/RSA.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ public function __construct(IL10N $l, IConfig $config) {
;
}

/**
* @return void
*/
public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = null) {
$auth = new RSACrypt();
$auth->setPassword($this->config->getSystemValue('secret', ''));
Expand Down
3 changes: 3 additions & 0 deletions apps/files_external/lib/Lib/Auth/PublicKey/RSAPrivateKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ public function __construct(IL10N $l, IConfig $config) {
]);
}

/**
* @return void
*/
public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = null) {
$auth = new RSACrypt();
$auth->setPassword($this->config->getSystemValue('secret', ''));
Expand Down
3 changes: 3 additions & 0 deletions apps/files_external/lib/Lib/Backend/InvalidBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ public function getInvalidId() {
return $this->invalidId;
}

/**
* @return void
*/
public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = null) {
$storage->setBackendOption('exception', new \Exception('Unknown storage backend "' . $this->invalidId . '"', StorageNotAvailableException::STATUS_ERROR));
}
Expand Down
3 changes: 3 additions & 0 deletions apps/files_external/lib/Lib/Backend/SMB.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ public function __construct(IL10N $l, Password $legacyAuth) {
->setLegacyAuthMechanism($legacyAuth);
}

/**
* @return void
*/
public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = null) {
$auth = $storage->getAuthMechanism();
if ($auth->getScheme() === AuthMechanism::SCHEME_PASSWORD) {
Expand Down
3 changes: 3 additions & 0 deletions apps/files_external/lib/Lib/Backend/SMB_OC.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ public function __construct(IL10N $l, SessionCredentials $legacyAuth, SMB $smbBa
;
}

/**
* @return void
*/
public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = null) {
$username_as_share = ($storage->getBackendOption('username_as_share') === true);

Expand Down
1 change: 1 addition & 0 deletions apps/files_external/lib/Lib/StorageModifierTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ trait StorageModifierTrait {
*
* @param StorageConfig $storage
* @param IUser $user User the storage is being used as
* @return void
* @throws InsufficientDataForMeaningfulAnswerException
* @throws StorageNotAvailableException
*/
Expand Down

0 comments on commit cd53e71

Please sign in to comment.