summaryrefslogtreecommitdiffstats
path: root/core/Controller
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2022-04-12 17:55:01 +0200
committerCarl Schwan <carl@carlschwan.eu>2022-05-20 22:18:06 +0200
commitb70c6a128fe5d0053b7971881696eafce4cb7c26 (patch)
tree641ff76531803c207a92d86f47d46b6dd93ab6d3 /core/Controller
parent2b0d82675f669f00ad90f2750b1832a60ec9f766 (diff)
downloadnextcloud-server-b70c6a128fe5d0053b7971881696eafce4cb7c26.tar.gz
nextcloud-server-b70c6a128fe5d0053b7971881696eafce4cb7c26.zip
Update core to PHP 7.4 standard
- Typed properties - Port to LoggerInterface Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Diffstat (limited to 'core/Controller')
-rw-r--r--core/Controller/AppPasswordController.php25
-rw-r--r--core/Controller/AutoCompleteController.php21
-rw-r--r--core/Controller/AvatarController.php70
-rw-r--r--core/Controller/CSRFTokenController.php10
-rw-r--r--core/Controller/ClientFlowLoginController.php76
-rw-r--r--core/Controller/ClientFlowLoginV2Controller.php24
-rw-r--r--core/Controller/CollaborationResourcesController.php20
-rw-r--r--core/Controller/CssController.php8
-rw-r--r--core/Controller/GuestAvatarController.php25
-rw-r--r--core/Controller/HoverCardController.php16
-rw-r--r--core/Controller/JsController.php8
-rw-r--r--core/Controller/LoginController.php43
-rw-r--r--core/Controller/LostController.php86
-rw-r--r--core/Controller/NavigationController.php20
-rw-r--r--core/Controller/OCJSController.php27
-rw-r--r--core/Controller/OCSController.php44
-rw-r--r--core/Controller/PreviewController.php42
-rw-r--r--core/Controller/ProfileApiController.php16
-rw-r--r--core/Controller/ProfilePageController.php24
-rw-r--r--core/Controller/RecommendedAppsController.php7
-rw-r--r--core/Controller/SearchController.php11
-rw-r--r--core/Controller/SetupController.php15
-rw-r--r--core/Controller/TwoFactorChallengeController.php38
-rw-r--r--core/Controller/UnifiedSearchController.php18
-rw-r--r--core/Controller/UserController.php5
-rw-r--r--core/Controller/WalledGardenController.php4
-rw-r--r--core/Controller/WebAuthnController.php19
27 files changed, 174 insertions, 548 deletions
diff --git a/core/Controller/AppPasswordController.php b/core/Controller/AppPasswordController.php
index 41f0f6e4f27..3f254f03370 100644
--- a/core/Controller/AppPasswordController.php
+++ b/core/Controller/AppPasswordController.php
@@ -42,21 +42,11 @@ use OCP\ISession;
use OCP\Security\ISecureRandom;
class AppPasswordController extends \OCP\AppFramework\OCSController {
-
- /** @var ISession */
- private $session;
-
- /** @var ISecureRandom */
- private $random;
-
- /** @var IProvider */
- private $tokenProvider;
-
- /** @var IStore */
- private $credentialStore;
-
- /** @var IEventDispatcher */
- private $eventDispatcher;
+ private ISession $session;
+ private ISecureRandom $random;
+ private IProvider $tokenProvider;
+ private IStore $credentialStore;
+ private IEventDispatcher $eventDispatcher;
public function __construct(string $appName,
IRequest $request,
@@ -77,7 +67,6 @@ class AppPasswordController extends \OCP\AppFramework\OCSController {
/**
* @NoAdminRequired
*
- * @return DataResponse
* @throws OCSForbiddenException
*/
public function getAppPassword(): DataResponse {
@@ -123,10 +112,8 @@ class AppPasswordController extends \OCP\AppFramework\OCSController {
/**
* @NoAdminRequired
- *
- * @return DataResponse
*/
- public function deleteAppPassword() {
+ public function deleteAppPassword(): DataResponse {
if (!$this->session->exists('app_password')) {
throw new OCSForbiddenException('no app password in use');
}
diff --git a/core/Controller/AutoCompleteController.php b/core/Controller/AutoCompleteController.php
index 9f0e43dedd6..f7174456731 100644
--- a/core/Controller/AutoCompleteController.php
+++ b/core/Controller/AutoCompleteController.php
@@ -39,14 +39,9 @@ use OCP\IRequest;
use OCP\Share\IShare;
class AutoCompleteController extends Controller {
- /** @var ISearch */
- private $collaboratorSearch;
-
- /** @var IManager */
- private $autoCompleteManager;
-
- /** @var IEventDispatcher */
- private $dispatcher;
+ private ISearch $collaboratorSearch;
+ private IManager $autoCompleteManager;
+ private IEventDispatcher $dispatcher;
public function __construct(string $appName,
IRequest $request,
@@ -62,16 +57,9 @@ class AutoCompleteController extends Controller {
/**
* @NoAdminRequired
- *
- * @param string $search
- * @param string $itemType
- * @param string $itemId
* @param string|null $sorter can be piped, top prio first, e.g.: "commenters|share-recipients"
- * @param array $shareTypes
- * @param int $limit
- * @return DataResponse
*/
- public function get($search, $itemType, $itemId, $sorter = null, $shareTypes = [IShare::TYPE_USER], $limit = 10): DataResponse {
+ public function get(string $search, ?string $itemType, ?string $itemId, ?string $sorter = null, array $shareTypes = [IShare::TYPE_USER], int $limit = 10): DataResponse {
// if enumeration/user listings are disabled, we'll receive an empty
// result from search() – thus nothing else to do here.
[$results,] = $this->collaboratorSearch->search($search, $shareTypes, false, $limit, 0);
@@ -106,7 +94,6 @@ class AutoCompleteController extends Controller {
return new DataResponse($results);
}
-
protected function prepareResultArray(array $results): array {
$output = [];
foreach ($results as $type => $subResult) {
diff --git a/core/Controller/AvatarController.php b/core/Controller/AvatarController.php
index d8c9745c139..e75b3493185 100644
--- a/core/Controller/AvatarController.php
+++ b/core/Controller/AvatarController.php
@@ -41,10 +41,10 @@ use OCP\Files\IRootFolder;
use OCP\IAvatarManager;
use OCP\ICache;
use OCP\IL10N;
-use OCP\ILogger;
use OCP\IRequest;
use OCP\IUserManager;
use OCP\IUserSession;
+use Psr\Log\LoggerInterface;
/**
* Class AvatarController
@@ -52,43 +52,25 @@ use OCP\IUserSession;
* @package OC\Core\Controller
*/
class AvatarController extends Controller {
-
- /** @var IAvatarManager */
- protected $avatarManager;
-
- /** @var ICache */
- protected $cache;
-
- /** @var IL10N */
- protected $l;
-
- /** @var IUserManager */
- protected $userManager;
-
- /** @var IUserSession */
- protected $userSession;
-
- /** @var IRootFolder */
- protected $rootFolder;
-
- /** @var ILogger */
- protected $logger;
-
- /** @var string */
- protected $userId;
-
- /** @var TimeFactory */
- protected $timeFactory;
-
- public function __construct($appName,
+ protected IAvatarManager $avatarManager;
+ protected ICache $cache;
+ protected IL10N $l;
+ protected IUserManager $userManager;
+ protected IUserSession $userSession;
+ protected IRootFolder $rootFolder;
+ protected LoggerInterface $logger;
+ protected ?string $userId;
+ protected TimeFactory $timeFactory;
+
+ public function __construct(string $appName,
IRequest $request,
IAvatarManager $avatarManager,
ICache $cache,
IL10N $l10n,
IUserManager $userManager,
IRootFolder $rootFolder,
- ILogger $logger,
- $userId,
+ LoggerInterface $logger,
+ ?string $userId,
TimeFactory $timeFactory) {
parent::__construct($appName, $request);
@@ -109,11 +91,9 @@ class AvatarController extends Controller {
* @NoSameSiteCookieRequired
* @PublicPage
*
- * @param string $userId
- * @param int $size
* @return JSONResponse|FileDisplayResponse
*/
- public function getAvatar($userId, $size) {
+ public function getAvatar(string $userId, int $size) {
if ($size <= 64) {
if ($size !== 64) {
$this->logger->debug('Avatar requested in deprecated size ' . $size);
@@ -145,11 +125,8 @@ class AvatarController extends Controller {
/**
* @NoAdminRequired
- *
- * @param string $path
- * @return JSONResponse
*/
- public function postAvatar($path) {
+ public function postAvatar(?string $path = null): JSONResponse {
$files = $this->request->getUploadedFile('files');
if (isset($path)) {
@@ -250,23 +227,21 @@ class AvatarController extends Controller {
);
}
} catch (\Exception $e) {
- $this->logger->logException($e, ['app' => 'core']);
+ $this->logger->error($e->getMessage(), ['exception' => $e, 'app' => 'core']);
return new JSONResponse(['data' => ['message' => $this->l->t('An error occurred. Please contact your admin.')]], Http::STATUS_OK);
}
}
/**
* @NoAdminRequired
- *
- * @return JSONResponse
*/
- public function deleteAvatar() {
+ public function deleteAvatar(): JSONResponse {
try {
$avatar = $this->avatarManager->getAvatar($this->userId);
$avatar->remove();
return new JSONResponse();
} catch (\Exception $e) {
- $this->logger->logException($e, ['app' => 'core']);
+ $this->logger->error($e->getMessage(), ['exception' => $e, 'app' => 'core']);
return new JSONResponse(['data' => ['message' => $this->l->t('An error occurred. Please contact your admin.')]], Http::STATUS_BAD_REQUEST);
}
}
@@ -301,11 +276,8 @@ class AvatarController extends Controller {
/**
* @NoAdminRequired
- *
- * @param array $crop
- * @return JSONResponse
*/
- public function postCroppedAvatar($crop) {
+ public function postCroppedAvatar(?array $crop = null): JSONResponse {
if (is_null($crop)) {
return new JSONResponse(['data' => ['message' => $this->l->t("No crop data provided")]],
Http::STATUS_BAD_REQUEST);
@@ -337,7 +309,7 @@ class AvatarController extends Controller {
return new JSONResponse(['data' => ['message' => $this->l->t('Crop is not square')]],
Http::STATUS_BAD_REQUEST);
} catch (\Exception $e) {
- $this->logger->logException($e, ['app' => 'core']);
+ $this->logger->error($e->getMessage(), ['exception' => $e, 'app' => 'core']);
return new JSONResponse(['data' => ['message' => $this->l->t('An error occurred. Please contact your admin.')]], Http::STATUS_BAD_REQUEST);
}
}
diff --git a/core/Controller/CSRFTokenController.php b/core/Controller/CSRFTokenController.php
index 510d5e64d9f..16288a8b318 100644
--- a/core/Controller/CSRFTokenController.php
+++ b/core/Controller/CSRFTokenController.php
@@ -33,15 +33,8 @@ use OCP\AppFramework\Http\JSONResponse;
use OCP\IRequest;
class CSRFTokenController extends Controller {
+ private CsrfTokenManager $tokenManager;
- /** @var CsrfTokenManager */
- private $tokenManager;
-
- /**
- * @param string $appName
- * @param IRequest $request
- * @param CsrfTokenManager $tokenManager
- */
public function __construct(string $appName, IRequest $request,
CsrfTokenManager $tokenManager) {
parent::__construct($appName, $request);
@@ -52,7 +45,6 @@ class CSRFTokenController extends Controller {
* @NoAdminRequired
* @NoCSRFRequired
* @PublicPage
- * @return JSONResponse
*/
public function index(): JSONResponse {
if (!$this->request->passesStrictCookieCheck()) {
diff --git a/core/Controller/ClientFlowLoginController.php b/core/Controller/ClientFlowLoginController.php
index d24a49ee376..4c262714fe6 100644
--- a/core/Controller/ClientFlowLoginController.php
+++ b/core/Controller/ClientFlowLoginController.php
@@ -56,47 +56,21 @@ use OCP\Security\ISecureRandom;
use OCP\Session\Exceptions\SessionNotAvailableException;
class ClientFlowLoginController extends Controller {
- /** @var IUserSession */
- private $userSession;
- /** @var IL10N */
- private $l10n;
- /** @var Defaults */
- private $defaults;
- /** @var ISession */
- private $session;
- /** @var IProvider */
- private $tokenProvider;
- /** @var ISecureRandom */
- private $random;
- /** @var IURLGenerator */
- private $urlGenerator;
- /** @var ClientMapper */
- private $clientMapper;
- /** @var AccessTokenMapper */
- private $accessTokenMapper;
- /** @var ICrypto */
- private $crypto;
- /** @var IEventDispatcher */
- private $eventDispatcher;
+ private IUserSession $userSession;
+ private IL10N $l10n;
+ private Defaults $defaults;
+ private ISession $session;
+ private IProvider $tokenProvider;
+ private ISecureRandom $random;
+ private IURLGenerator $urlGenerator;
+ private ClientMapper $clientMapper;
+ private AccessTokenMapper $accessTokenMapper;
+ private ICrypto $crypto;
+ private IEventDispatcher $eventDispatcher;
public const STATE_NAME = 'client.flow.state.token';
- /**
- * @param string $appName
- * @param IRequest $request
- * @param IUserSession $userSession
- * @param IL10N $l10n
- * @param Defaults $defaults
- * @param ISession $session
- * @param IProvider $tokenProvider
- * @param ISecureRandom $random
- * @param IURLGenerator $urlGenerator
- * @param ClientMapper $clientMapper
- * @param AccessTokenMapper $accessTokenMapper
- * @param ICrypto $crypto
- * @param IEventDispatcher $eventDispatcher
- */
- public function __construct($appName,
+ public function __construct(string $appName,
IRequest $request,
IUserSession $userSession,
IL10N $l10n,
@@ -123,30 +97,20 @@ class ClientFlowLoginController extends Controller {
$this->eventDispatcher = $eventDispatcher;
}
- /**
- * @return string
- */
- private function getClientName() {
+ private function getClientName(): string {
$userAgent = $this->request->getHeader('USER_AGENT');
return $userAgent !== '' ? $userAgent : 'unknown';
}
- /**
- * @param string $stateToken
- * @return bool
- */
- private function isValidToken($stateToken) {
+ private function isValidToken(string $stateToken): bool {
$currentToken = $this->session->get(self::STATE_NAME);
- if (!is_string($stateToken) || !is_string($currentToken)) {
+ if (!is_string($currentToken)) {
return false;
}
return hash_equals($currentToken, $stateToken);
}
- /**
- * @return StandaloneTemplateResponse
- */
- private function stateTokenForbiddenResponse() {
+ private function stateTokenForbiddenResponse(): StandaloneTemplateResponse {
$response = new StandaloneTemplateResponse(
$this->appName,
'403',
@@ -281,12 +245,10 @@ class ClientFlowLoginController extends Controller {
* @NoAdminRequired
* @UseSession
*
- * @param string $stateToken
- * @param string $clientIdentifier
* @return Http\RedirectResponse|Response
*/
- public function generateAppPassword($stateToken,
- $clientIdentifier = '') {
+ public function generateAppPassword(string $stateToken,
+ string $clientIdentifier = '') {
if (!$this->isValidToken($stateToken)) {
$this->session->remove(self::STATE_NAME);
return $this->stateTokenForbiddenResponse();
@@ -375,7 +337,7 @@ class ClientFlowLoginController extends Controller {
/**
* @PublicPage
*/
- public function apptokenRedirect(string $stateToken, string $user, string $password) {
+ public function apptokenRedirect(string $stateToken, string $user, string $password): Response {
if (!$this->isValidToken($stateToken)) {
return $this->stateTokenForbiddenResponse();
}
diff --git a/core/Controller/ClientFlowLoginV2Controller.php b/core/Controller/ClientFlowLoginV2Controller.php
index 27585cbdb7e..3c57b190593 100644
--- a/core/Controller/ClientFlowLoginV2Controller.php
+++ b/core/Controller/ClientFlowLoginV2Controller.php
@@ -50,22 +50,14 @@ class ClientFlowLoginV2Controller extends Controller {
public const TOKEN_NAME = 'client.flow.v2.login.token';
public const STATE_NAME = 'client.flow.v2.state.token';
- /** @var LoginFlowV2Service */
- private $loginFlowV2Service;
- /** @var IURLGenerator */
- private $urlGenerator;
- /** @var ISession */
- private $session;
- /** @var IUserSession */
- private $userSession;
- /** @var ISecureRandom */
- private $random;
- /** @var Defaults */
- private $defaults;
- /** @var string */
- private $userId;
- /** @var IL10N */
- private $l10n;
+ private LoginFlowV2Service $loginFlowV2Service;
+ private IURLGenerator $urlGenerator;
+ private IUserSession $userSession;
+ private ISession $session;
+ private ISecureRandom $random;
+ private Defaults $defaults;
+ private ?string $userId;
+ private IL10N $l10n;
public function __construct(string $appName,
IRequest $request,
diff --git a/core/Controller/CollaborationResourcesController.php b/core/Controller/CollaborationResourcesController.php
index 114423e1a2f..659ff32baee 100644
--- a/core/Controller/CollaborationResourcesController.php
+++ b/core/Controller/CollaborationResourcesController.php
@@ -36,25 +36,21 @@ use OCP\Collaboration\Resources\ICollection;
use OCP\Collaboration\Resources\IManager;
use OCP\Collaboration\Resources\IResource;
use OCP\Collaboration\Resources\ResourceException;
-use OCP\ILogger;
use OCP\IRequest;
use OCP\IUserSession;
+use Psr\Log\LoggerInterface;
class CollaborationResourcesController extends OCSController {
-
- /** @var IManager */
- private $manager;
- /** @var IUserSession */
- private $userSession;
- /** @var ILogger */
- private $logger;
+ private IManager $manager;
+ private IUserSession $userSession;
+ private LoggerInterface $logger;
public function __construct(
string $appName,
IRequest $request,
IManager $manager,
IUserSession $userSession,
- ILogger $logger
+ LoggerInterface $logger
) {
parent::__construct($appName, $request);
@@ -240,7 +236,7 @@ class CollaborationResourcesController extends OCSController {
} catch (CollectionException $e) {
return new DataResponse([], Http::STATUS_NOT_FOUND);
} catch (Exception $e) {
- $this->logger->logException($e);
+ $this->logger->critical($e->getMessage(), ['exception' => $e, 'app' => 'core']);
return new DataResponse([], Http::STATUS_INTERNAL_SERVER_ERROR);
}
}
@@ -253,7 +249,7 @@ class CollaborationResourcesController extends OCSController {
$result[] = $this->prepareCollection($collection);
} catch (CollectionException $e) {
} catch (Exception $e) {
- $this->logger->logException($e);
+ $this->logger->critical($e->getMessage(), ['exception' => $e, 'app' => 'core']);
}
}
@@ -280,7 +276,7 @@ class CollaborationResourcesController extends OCSController {
$result[] = $this->prepareResource($resource);
} catch (ResourceException $e) {
} catch (Exception $e) {
- $this->logger->logException($e);
+ $this->logger->critical($e->getMessage(), ['exception' => $e, 'app' => 'core']);
}
}
diff --git a/core/Controller/CssController.php b/core/Controller/CssController.php
index e1d7d5178cd..4cd2996835e 100644
--- a/core/Controller/CssController.php
+++ b/core/Controller/CssController.php
@@ -44,12 +44,8 @@ use OCP\Files\SimpleFS\ISimpleFolder;
use OCP\IRequest;
class CssController extends Controller {
-
- /** @var IAppData */
- protected $appData;
-
- /** @var ITimeFactory */
- protected $timeFactory;
+ protected IAppData $appData;
+ protected ITimeFactory $timeFactory;
public function __construct(string $appName,
IRequest $request,
diff --git a/core/Controller/GuestAvatarController.php b/core/Controller/GuestAvatarController.php
index 6d14474ed44..9c0606f368f 100644
--- a/core/Controller/GuestAvatarController.php
+++ b/core/Controller/GuestAvatarController.php
@@ -26,37 +26,24 @@ use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\FileDisplayResponse;
use OCP\IAvatarManager;
-use OCP\ILogger;
use OCP\IRequest;
+use Psr\Log\LoggerInterface;
/**
* This controller handles guest avatar requests.
*/
class GuestAvatarController extends Controller {
-
- /**
- * @var ILogger
- */
- private $logger;
-
- /**
- * @var IAvatarManager
- */
- private $avatarManager;
+ private LoggerInterface $logger;
+ private IAvatarManager $avatarManager;
/**
* GuestAvatarController constructor.
- *
- * @param $appName
- * @param IRequest $request
- * @param IAvatarManager $avatarManager
- * @param ILogger $logger
*/
public function __construct(
- $appName,
+ string $appName,
IRequest $request,
IAvatarManager $avatarManager,
- ILogger $logger
+ LoggerInterface $logger
) {
parent::__construct($appName, $request);
$this->avatarManager = $avatarManager;
@@ -73,7 +60,7 @@ class GuestAvatarController extends Controller {
* @param string $size The desired avatar size, e.g. 64 for 64x64px
* @return FileDisplayResponse|Http\Response
*/
- public function getAvatar($guestName, $size) {
+ public function getAvatar(string $guestName, string $size) {
$size = (int) $size;
if ($size <= 64) {
diff --git a/core/Controller/HoverCardController.php b/core/Controller/HoverCardController.php
index cb85da112a4..632cdd0d02f 100644
--- a/core/Controller/HoverCardController.php
+++ b/core/Controller/HoverCardController.php
@@ -33,18 +33,9 @@ use OCP\IUserSession;
use OCP\Share\IShare;
class HoverCardController extends \OCP\AppFramework\OCSController {
+ private Manager $manager;
+ private IUserSession $userSession;
- /** @var Manager */
- private $manager;
-
- /** @var IUserSession */
- private $userSession;
-
- /**
- * @param IRequest $request
- * @param IUserSession $userSession
- * @param Manager $manager
- */
public function __construct(IRequest $request, IUserSession $userSession, Manager $manager) {
parent::__construct('core', $request);
$this->userSession = $userSession;
@@ -53,9 +44,6 @@ class HoverCardController extends \OCP\AppFramework\OCSController {
/**
* @NoAdminRequired
- *
- * @param string $userId
- * @return DataResponse
*/
public function getUser(string $userId): DataResponse {
$contact = $this->manager->findOne($this->userSession->getUser(), IShare::TYPE_USER, $userId);
diff --git a/core/Controller/JsController.php b/core/Controller/JsController.php
index 937df073e81..885de5491e7 100644
--- a/core/Controller/JsController.php
+++ b/core/Controller/JsController.php
@@ -44,12 +44,8 @@ use OCP\Files\SimpleFS\ISimpleFolder;
use OCP\IRequest;
class JsController extends Controller {
-
- /** @var IAppData */
- protected $appData;
-
- /** @var ITimeFactory */
- protected $timeFactory;
+ protected IAppData $appData;
+ protected ITimeFactory $timeFactory;
public function __construct($appName, IRequest $request, Factory $appDataFactory, ITimeFactory $timeFactory) {
parent::__construct($appName, $request);
diff --git a/core/Controller/LoginController.php b/core/Controller/LoginController.php
index b68f91f986e..ff2cb641f88 100644
--- a/core/Controller/LoginController.php
+++ b/core/Controller/LoginController.php
@@ -47,7 +47,6 @@ use OCP\Defaults;
use OCP\IConfig;
use OCP\IInitialStateService;
use OCP\IL10N;
-use OCP\ILogger;
use OCP\IRequest;
use OCP\ISession;
use OCP\IURLGenerator;
@@ -61,32 +60,19 @@ class LoginController extends Controller {
public const LOGIN_MSG_INVALIDPASSWORD = 'invalidpassword';
public const LOGIN_MSG_USERDISABLED = 'userdisabled';
- /** @var IUserManager */
- private $userManager;
- /** @var IConfig */
- private $config;
- /** @var ISession */
- private $session;
+ private IUserManager $userManager;
+ private IConfig $config;
+ private ISession $session;
/** @var IUserSession|Session */
private $userSession;
- /** @var IURLGenerator */
- private $urlGenerator;
- /** @var ILogger */
- private $logger;
- /** @var Defaults */
- private $defaults;
- /** @var Throttler */
- private $throttler;
- /** @var Chain */
- private $loginChain;
- /** @var IInitialStateService */
- private $initialStateService;
- /** @var WebAuthnManager */
- private $webAuthnManager;
- /** @var IManager */
- private $manager;
- /** @var IL10N */
- private $l10n;
+ private IURLGenerator $urlGenerator;
+ private Defaults $defaults;
+ private Throttler $throttler;
+ private Chain $loginChain;
+ private IInitialStateService $initialStateService;
+ private WebAuthnManager $webAuthnManager;
+ private IManager $manager;
+ private IL10N $l10n;
public function __construct(?string $appName,
IRequest $request,
@@ -95,7 +81,6 @@ class LoginController extends Controller {
ISession $session,
IUserSession $userSession,
IURLGenerator $urlGenerator,
- ILogger $logger,
Defaults $defaults,
Throttler $throttler,
Chain $loginChain,
@@ -109,7 +94,6 @@ class LoginController extends Controller {
$this->session = $session;
$this->userSession = $userSession;
$this->urlGenerator = $urlGenerator;
- $this->logger = $logger;
$this->defaults = $defaults;
$this->throttler = $throttler;
$this->loginChain = $loginChain;
@@ -375,13 +359,10 @@ class LoginController extends Controller {
* @UseSession
* @BruteForceProtection(action=sudo)
*
- * @param string $password
- *
- * @return DataResponse
* @license GNU AGPL version 3 or any later version
*
*/
- public function confirmPassword($password) {
+ public function confirmPassword(string $password): DataResponse {
$loginName = $this->userSession->getLoginName();
$loginResult = $this->userManager->checkPassword($loginName, $password);
if ($loginResult === false) {
diff --git a/core/Controller/LostController.php b/core/Controller/LostController.php
index 87a629b9ee8..e0f16226bff 100644
--- a/core/Controller/LostController.php
+++ b/core/Controller/LostController.php
@@ -47,7 +47,6 @@ use OCP\HintException;
use OCP\IConfig;
use OCP\IInitialStateService;
use OCP\IL10N;
-use OCP\ILogger;
use OCP\IRequest;
use OCP\IURLGenerator;
use OCP\IUser;
@@ -55,6 +54,7 @@ use OCP\IUserManager;
use OCP\Mail\IMailer;
use OCP\Security\VerificationToken\InvalidTokenException;
use OCP\Security\VerificationToken\IVerificationToken;
+use Psr\Log\LoggerInterface;
use function array_filter;
use function count;
use function reset;
@@ -67,33 +67,21 @@ use function reset;
* @package OC\Core\Controller
*/
class LostController extends Controller {
- /** @var IURLGenerator */
- protected $urlGenerator;
- /** @var IUserManager */
- protected $userManager;
- /** @var Defaults */
- protected $defaults;
- /** @var IL10N */
- protected $l10n;
- /** @var string */
- protected $from;
- /** @var IManager */
- protected $encryptionManager;
- /** @var IConfig */
- protected $config;
- /** @var IMailer */
- protected $mailer;
- /** @var ILogger */
- private $logger;
- /** @var Manager */
- private $twoFactorManager;
- /** @var IInitialStateService */
- private $initialStateService;
- /** @var IVerificationToken */
- private $verificationToken;
+ protected IURLGenerator $urlGenerator;
+ protected IUserManager $userManager;
+ protected Defaults $defaults;
+ protected IL10N $l10n;
+ protected string $from;
+ protected IManager $encryptionManager;
+ protected IConfig $config;
+ protected IMailer $mailer;
+ private LoggerInterface $logger;
+ private Manager $twoFactorManager;
+ private IInitialStateService $initialStateService;
+ private IVerificationToken $verificationToken;
public function __construct(
- $appName,
+ string $appName,
IRequest $request,
IURLGenerator $urlGenerator,
IUserManager $userManager,
@@ -103,7 +91,7 @@ class LostController extends Controller {
$defaultMailAddress,
IManager $encryptionManager,
IMailer $mailer,
- ILogger $logger,
+ LoggerInterface $logger,
Manager $twoFactorManager,
IInitialStateService $initialStateService,
IVerificationToken $verificationToken
@@ -128,12 +116,8 @@ class LostController extends Controller {
*
* @PublicPage
* @NoCSRFRequired
- *
- * @param string $token
- * @param string $userId
- * @return TemplateResponse
*/
- public function resetform($token, $userId) {
+ public function resetform(string $token, string $userId): TemplateResponse {
try {
$this->checkPasswordResetToken($token, $userId);
} catch (\Exception $e) {
@@ -168,8 +152,6 @@ class LostController extends Controller {
}
/**
- * @param string $token
- * @param string $userId
* @throws \Exception
*/
protected function checkPasswordResetToken(string $token, string $userId): void {
@@ -184,20 +166,11 @@ class LostController extends Controller {
}
}
- /**
- * @param $message
- * @param array $additional
- * @return array
- */
- private function error($message, array $additional = []) {
+ private function error(string $message, array $additional = []): array {
return array_merge(['status' => 'error', 'msg' => $message], $additional);
}
- /**
- * @param array $data
- * @return array
- */
- private function success($data = []) {
+ private function success(array $data = []): array {
return array_merge($data, ['status' => 'success']);
}
@@ -205,11 +178,8 @@ class LostController extends Controller {
* @PublicPage
* @BruteForceProtection(action=passwordResetEmail)
* @AnonRateThrottle(limit=10, period=300)
- *
- * @param string $user
- * @return JSONResponse
*/
- public function email($user) {
+ public function email(string $user): JSONResponse {
if ($this->config->getSystemValue('lost_password_link', '') !== '') {
return new JSONResponse($this->error($this->l10n->t('Password reset is disabled')));
}
@@ -227,7 +197,7 @@ class LostController extends Controller {
// Ignore the error since we do not want to leak this info
$this->logger->warning('Could not send password reset email: ' . $e->getMessage());
} catch (\Exception $e) {
- $this->logger->logException($e);
+ $this->logger->error($e->getMessage(), ['exception' => $e]);
}
$response = new JSONResponse($this->success());
@@ -237,13 +207,8 @@ class LostController extends Controller {
/**
* @PublicPage
- * @param string $token
- * @param string $userId
- * @param string $password
- * @param boolean $proceed
- * @return array
*/
- public function setPassword($token, $userId, $password, $proceed) {
+ public function setPassword(string $token, string $userId, string $password, bool $proceed): array {
if ($this->encryptionManager->isEnabled() && !$proceed) {
$encryptionModules = $this->encryptionManager->getEncryptionModules();
foreach ($encryptionModules as $module) {
@@ -282,11 +247,10 @@ class LostController extends Controller {
}
/**
- * @param string $input
* @throws ResetPasswordException
* @throws \OCP\PreConditionNotMetException
*/
- protected function sendEmail($input) {
+ protected function sendEmail(string $input): void {
$user = $this->findUserByIdOrMail($input);
$email = $user->getEMailAddress();
@@ -330,16 +294,14 @@ class LostController extends Controller {
$this->mailer->send($message);
} catch (\Exception $e) {
// Log the exception and continue
- $this->logger->logException($e);
+ $this->logger->error($e->getMessage(), ['app' => 'core', 'exception' => $e]);
}
}
/**
- * @param string $input
- * @return IUser
* @throws ResetPasswordException
*/
- protected function findUserByIdOrMail($input) {
+ protected function findUserByIdOrMail(string $input): IUser {
$user = $this->userManager->get($input);
if ($user instanceof IUser) {
if (!$user->isEnabled()) {
diff --git a/core/Controller/NavigationController.php b/core/Controller/NavigationController.php
index 9d0565145c3..6b994ca33f1 100644
--- a/core/Controller/NavigationController.php
+++ b/core/Controller/NavigationController.php
@@ -30,12 +30,8 @@ use OCP\IRequest;
use OCP\IURLGenerator;
class NavigationController extends OCSController {
-
- /** @var INavigationManager */
- private $navigationManager;
-
- /** @var IURLGenerator */
- private $urlGenerator;
+ private INavigationManager $navigationManager;
+ private IURLGenerator $urlGenerator;
public function __construct(string $appName, IRequest $request, INavigationManager $navigationManager, IURLGenerator $urlGenerator) {
parent::__construct($appName, $request);
@@ -46,9 +42,6 @@ class NavigationController extends OCSController {
/**
* @NoAdminRequired
* @NoCSRFRequired
- *
- * @param bool $absolute
- * @return DataResponse
*/
public function getAppsNavigation(bool $absolute = false): DataResponse {
$navigation = $this->navigationManager->getAll();
@@ -68,9 +61,6 @@ class NavigationController extends OCSController {
/**
* @NoAdminRequired
* @NoCSRFRequired
- *
- * @param bool $absolute
- * @return DataResponse
*/
public function getSettingsNavigation(bool $absolute = false): DataResponse {
$navigation = $this->navigationManager->getAll('settings');
@@ -89,9 +79,6 @@ class NavigationController extends OCSController {
/**
* Generate an ETag for a list of navigation entries
- *
- * @param array $navigation
- * @return string
*/
private function generateETag(array $navigation): string {
foreach ($navigation as &$nav) {
@@ -104,9 +91,6 @@ class NavigationController extends OCSController {
/**
* Rewrite href attribute of navigation entries to an absolute URL
- *
- * @param array $navigation
- * @return array
*/
private function rewriteToAbsoluteUrls(array $navigation): array {
foreach ($navigation as &$entry) {
diff --git a/core/Controller/OCJSController.php b/core/Controller/OCJSController.php
index 379b08bf22e..fa13f21607c 100644
--- a/core/Controller/OCJSController.php
+++ b/core/Controller/OCJSController.php
@@ -45,28 +45,9 @@ use OCP\IUserSession;
use OCP\L10N\IFactory;
class OCJSController extends Controller {
+ private JSConfigHelper $helper;
- /** @var JSConfigHelper */
- private $helper;
-
- /**
- * OCJSController constructor.
- *
- * @param string $appName
- * @param IRequest $request
- * @param IFactory $l10nFactory
- * @param Defaults $defaults
- * @param IAppManager $appManager
- * @param ISession $session
- * @param IUserSession $userSession
- * @param IConfig $config
- * @param IGroupManager $groupManager
- * @param IniGetWrapper $iniWrapper
- * @param IURLGenerator $urlGenerator
- * @param CapabilitiesManager $capabilitiesManager
- * @param IInitialStateService $initialStateService
- */
- public function __construct($appName,
+ public function __construct(string $appName,
IRequest $request,
IFactory $l10nFactory,
Defaults $defaults,
@@ -100,10 +81,8 @@ class OCJSController extends Controller {
* @NoCSRFRequired
* @NoTwoFactorRequired
* @PublicPage
- *
- * @return DataDisplayResponse
*/
- public function getConfig() {
+ public function getConfig(): DataDisplayResponse {
$data = $this->helper->getConfig();
return new DataDisplayResponse($data, Http::STATUS_OK, ['Content-type' => 'text/javascript']);
diff --git a/core/Controller/OCSController.php b/core/Controller/OCSController.php
index 63a25591ef0..b40776fcfb8 100644
--- a/core/Controller/OCSController.php
+++ b/core/Controller/OCSController.php
@@ -35,27 +35,12 @@ use OCP\IUserManager;
use OCP\IUserSession;
class OCSController extends \OCP\AppFramework\OCSController {
+ private CapabilitiesManager $capabilitiesManager;
+ private IUserSession $userSession;
+ private IUserManager $userManager;
+ private Manager $keyManager;
- /** @var CapabilitiesManager */
- private $capabilitiesManager;
- /** @var IUserSession */
- private $userSession;
- /** @var IUserManager */
- private $userManager;
- /** @var Manager */
- private $keyManager;
-
- /**
- * OCSController constructor.
- *
- * @param string $appName
- * @param IRequest $request
- * @param CapabilitiesManager $capabilitiesManager
- * @param IUserSession $userSession
- * @param IUserManager $userManager
- * @param Manager $keyManager
- */
- public function __construct($appName,
+ public function __construct(string $appName,
IRequest $request,
CapabilitiesManager $capabilitiesManager,
IUserSession $userSession,
@@ -70,10 +55,8 @@ class OCSController extends \OCP\AppFramework\OCSController {
/**
* @PublicPage
- *
- * @return DataResponse
*/
- public function getConfig() {
+ public function getConfig(): DataResponse {
$data = [
'version' => '1.7',
'website' => 'Nextcloud',
@@ -87,10 +70,8 @@ class OCSController extends \OCP\AppFramework\OCSController {
/**
* @PublicPage
- *
- * @return DataResponse
*/
- public function getCapabilities() {
+ public function getCapabilities(): DataResponse {
$result = [];
[$major, $minor, $micro] = \OCP\Util::getVersion();
$result['version'] = [
@@ -116,12 +97,8 @@ class OCSController extends \OCP\AppFramework\OCSController {
/**
* @PublicPage
* @BruteForceProtection(action=login)
- *
- * @param string $login
- * @param string $password
- * @return DataResponse
*/
- public function personCheck($login = '', $password = '') {
+ public function personCheck(string $login = '', string $password = ''): DataResponse {
if ($login !== '' && $password !== '') {
if ($this->userManager->checkPassword($login, $password)) {
return new DataResponse([
@@ -140,11 +117,8 @@ class OCSController extends \OCP\AppFramework\OCSController {
/**
* @PublicPage
- *
- * @param string $cloudId
- * @return DataResponse
*/
- public function getIdentityProof($cloudId) {
+ public function getIdentityProof(string $cloudId): DataResponse {
$userObject = $this->userManager->get($cloudId);
if ($userObject !== null) {
diff --git a/core/Controller/PreviewController.php b/core/Controller/PreviewController.php
index 30b0a45c13d..85dedd0bf68 100644
--- a/core/Controller/PreviewController.php
+++ b/core/Controller/PreviewController.php
@@ -31,7 +31,6 @@ use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\Http\FileDisplayResponse;
-use OCP\AppFramework\Utility\ITimeFactory;
use OCP\Files\File;
use OCP\Files\IRootFolder;
use OCP\Files\Node;
@@ -40,26 +39,10 @@ use OCP\IPreview;
use OCP\IRequest;
class PreviewController extends Controller {
+ private string $userId;
+ private IRootFolder $root;
+ private IPreview $preview;
- /** @var string */
- private $userId;
-
- /** @var IRootFolder */
- private $root;
-
- /** @var IPreview */
- private $preview;
-
- /**
- * PreviewController constructor.
- *
- * @param string $appName
- * @param IRequest $request
- * @param IPreview $preview
- * @param IRootFolder $root
- * @param string $userId
- * @param ITimeFactory $timeFactory
- */
public function __construct(string $appName,
IRequest $request,
IPreview $preview,
@@ -77,12 +60,6 @@ class PreviewController extends Controller {
* @NoAdminRequired
* @NoCSRFRequired
*
- * @param string $file
- * @param int $x
- * @param int $y
- * @param bool $a
- * @param bool $forceIcon
- * @param string $mode
* @return DataResponse|FileDisplayResponse
*/
public function getPreview(
@@ -110,13 +87,6 @@ class PreviewController extends Controller {
* @NoAdminRequired
* @NoCSRFRequired
*
- * @param int $fileId
- * @param int $x
- * @param int $y
- * @param bool $a
- * @param bool $forceIcon
- * @param string $mode
- *
* @return DataResponse|FileDisplayResponse
*/
public function getPreviewByFileId(
@@ -143,12 +113,6 @@ class PreviewController extends Controller {
}
/**
- * @param Node $node
- * @param int $x
- * @param int $y
- * @param bool $a
- * @param bool $forceIcon
- * @param string $mode
* @return DataResponse|FileDisplayResponse
*/
private function fetchPreview(
diff --git a/core/Controller/ProfileApiController.php b/core/Controller/ProfileApiController.php
index d9e20701eaa..a25ebaf846d 100644
--- a/core/Controller/ProfileApiController.php
+++ b/core/Controller/ProfileApiController.php
@@ -38,18 +38,10 @@ use OCP\IUserSession;
use OC\Profile\ProfileManager;
class ProfileApiController extends OCSController {
-
- /** @var ProfileConfigMapper */
- private $configMapper;
-
- /** @var ProfileManager */
- private $profileManager;
-
- /** @var IUserManager */
- private $userManager;
-
- /** @var IUserSession */
- private $userSession;
+ private ProfileConfigMapper $configMapper;
+ private ProfileManager $profileManager;
+ private IUserManager $userManager;
+ private IUserSession $userSession;
public function __construct(
IRequest $request,
diff --git a/core/Controller/ProfilePageController.php b/core/Controller/ProfilePageController.php
index 5a1c8a68e6b..515c1c5a352 100644
--- a/core/Controller/ProfilePageController.php
+++ b/core/Controller/ProfilePageController.php
@@ -38,24 +38,12 @@ use OCP\Share\IManager as IShareManager;
use OCP\UserStatus\IManager as IUserStatusManager;
class ProfilePageController extends Controller {
-
- /** @var IInitialState */
- private $initialStateService;
-
- /** @var ProfileManager */
- private $profileManager;
-
- /** @var IShareManager */
- private $shareManager;
-
- /** @var IUserManager */
- private $userManager;
-
- /** @var IUserSession */
- private $userSession;
-
- /** @var IUserStatusManager */
- private $userStatusManager;
+ private IInitialState $initialStateService;
+ private ProfileManager $profileManager;
+ private IShareManager $shareManager;
+ private IUserManager $userManager;
+ private IUserSession $userSession;
+ private IUserStatusManager $userStatusManager;
public function __construct(
$appName,
diff --git a/core/Controller/RecommendedAppsController.php b/core/Controller/RecommendedAppsController.php
index b38aaa31fca..5c73f3c5f5e 100644
--- a/core/Controller/RecommendedAppsController.php
+++ b/core/Controller/RecommendedAppsController.php
@@ -33,11 +33,8 @@ use OCP\IRequest;
use OCP\IURLGenerator;
class RecommendedAppsController extends Controller {
-
- /** @var IURLGenerator */
- public $urlGenerator;
- /** @var IInitialStateService */
- private $initialStateService;
+ public IURLGenerator $urlGenerator;
+ private IInitialStateService $initialStateService;
public function __construct(IRequest $request,
IURLGenerator $urlGenerator,
diff --git a/core/Controller/SearchController.php b/core/Controller/SearchController.php
index 95d100a393d..5881ec2db86 100644
--- a/core/Controller/SearchController.php
+++ b/core/Controller/SearchController.php
@@ -28,23 +28,20 @@ namespace OC\Core\Controller;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\JSONResponse;
-use OCP\ILogger;
use OCP\IRequest;
use OCP\ISearch;
use OCP\Search\Result;
+use Psr\Log\LoggerInterface;
class SearchController extends Controller {
-
- /** @var ISearch */
- private $searcher;
- /** @var ILogger */
- private $logger;
+ private ISearch $searcher;
+ private LoggerInterface $logger;
public function __construct(
string $appName,
IRequest $request,
ISearch $search,
- ILogger $logger
+ LoggerInterface $logger
) {
parent::__construct($appName, $request);
diff --git a/core/Controller/SetupController.php b/core/Controller/SetupController.php
index 620b4f12df7..ab8b1973bf2 100644
--- a/core/Controller/SetupController.php
+++ b/core/Controller/SetupController.php
@@ -35,10 +35,8 @@ use OC\Setup;
use OCP\ILogger;
class SetupController {
- /** @var Setup */
- protected $setupHelper;
- /** @var string */
- private $autoConfigFile;
+ protected Setup $setupHelper;
+ private string $autoConfigFile;
/**
* @param Setup $setupHelper
@@ -48,10 +46,7 @@ class SetupController {
$this->setupHelper = $setupHelper;
}
- /**
- * @param $post
- */
- public function run($post) {
+ public function run(array $post): void {
// Check for autosetup:
$post = $this->loadAutoConfig($post);
$opts = $this->setupHelper->getSystemInfo();
@@ -90,7 +85,7 @@ class SetupController {
\OC_Template::printGuestPage('', 'installation_forbidden');
}
- public function display($post) {
+ public function display($post): void {
$defaults = [
'adminlogin' => '',
'adminpass' => '',
@@ -122,7 +117,7 @@ class SetupController {
exit();
}
- public function loadAutoConfig($post) {
+ public function loadAutoConfig(array $post): array {
if (file_exists($this->autoConfigFile)) {
\OCP\Util::writeLog('core', 'Autoconfig file found, setting up Nextcloud…', ILogger::INFO);
$AUTOCONFIG = [];
diff --git a/core/Controller/TwoFactorChallengeController.php b/core/Controller/TwoFactorChallengeController.php
index 8f82346c050..deebeb21d32 100644
--- a/core/Controller/TwoFactorChallengeController.php
+++ b/core/Controller/TwoFactorChallengeController.php
@@ -34,40 +34,21 @@ use OCP\Authentication\TwoFactorAuth\IActivatableAtLogin;
use OCP\Authentication\TwoFactorAuth\IProvider;
use OCP\Authentication\TwoFactorAuth\IProvidesCustomCSP;
use OCP\Authentication\TwoFactorAuth\TwoFactorException;
-use OCP\ILogger;
use OCP\IRequest;
use OCP\ISession;
use OCP\IURLGenerator;
use OCP\IUserSession;
+use Psr\Log\LoggerInterface;
class TwoFactorChallengeController extends Controller {
+ private Manager $twoFactorManager;
+ private IUserSession $userSession;
+ private ISession $session;
+ private LoggerInterface $logger;
+ private IURLGenerator $urlGenerator;
- /** @var Manager */
- private $twoFactorManager;
-
- /** @var IUserSession */
- private $userSession;
-
- /** @var ISession */
- private $session;
-
- /** @var ILogger */
- private $logger;
-
- /** @var IURLGenerator */
- private $urlGenerator;
-
- /**
- * @param string $appName
- * @param IRequest $request
- * @param Manager $twoFactorManager
- * @param IUserSession $userSession
- * @param ISession $session
- * @param IURLGenerator $urlGenerator
- * @param ILogger $logger
- */
public function __construct($appName, IRequest $request, Manager $twoFactorManager, IUserSession $userSession,
- ISession $session, IURLGenerator $urlGenerator, ILogger $logger) {
+ ISession $session, IURLGenerator $urlGenerator, LoggerInterface $logger) {
parent::__construct($appName, $request);
$this->twoFactorManager = $twoFactorManager;
$this->userSession = $userSession;
@@ -227,7 +208,7 @@ class TwoFactorChallengeController extends Controller {
* @NoAdminRequired
* @NoCSRFRequired
*/
- public function setupProviders() {
+ public function setupProviders(): StandaloneTemplateResponse {
$user = $this->userSession->getUser();
$setupProviders = $this->twoFactorManager->getLoginSetupProviders($user);
@@ -236,8 +217,7 @@ class TwoFactorChallengeController extends Controller {
'logout_url' => $this->getLogoutUrl(),
];
- $response = new StandaloneTemplateResponse($this->appName, 'twofactorsetupselection', $data, 'guest');
- return $response;
+ return new StandaloneTemplateResponse($this->appName, 'twofactorsetupselection', $data, 'guest');
}
/**
diff --git a/core/Controller/UnifiedSearchController.php b/core/Controller/UnifiedSearchController.php
index bfed6d606ae..3290307dc23 100644
--- a/core/Controller/UnifiedSearchController.php
+++ b/core/Controller/UnifiedSearchController.php
@@ -40,18 +40,10 @@ use OCP\Search\ISearchQuery;
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
class UnifiedSearchController extends OCSController {
-
- /** @var SearchComposer */
- private $composer;
-
- /** @var IUserSession */
- private $userSession;
-
- /** @var IRouter */
- private $router;
-
- /** @var IURLGenerator */
- private $urlGenerator;
+ private SearchComposer $composer;
+ private IUserSession $userSession;
+ private IRouter $router;
+ private IURLGenerator $urlGenerator;
public function __construct(IRequest $request,
IUserSession $userSession,
@@ -71,8 +63,6 @@ class UnifiedSearchController extends OCSController {
* @NoCSRFRequired
*
* @param string $from the url the user is currently at
- *
- * @return DataResponse
*/
public function getProviders(string $from = ''): DataResponse {
[$route, $parameters] = $this->getRouteInformation($from);
diff --git a/core/Controller/UserController.php b/core/Controller/UserController.php
index 6d50348c2a5..b9946dfaec6 100644
--- a/core/Controller/UserController.php
+++ b/core/Controller/UserController.php
@@ -30,10 +30,7 @@ use OCP\IRequest;
use OCP\IUserManager;
class UserController extends Controller {
- /**
- * @var IUserManager
- */
- protected $userManager;
+ protected IUserManager $userManager;
public function __construct($appName,
IRequest $request,
diff --git a/core/Controller/WalledGardenController.php b/core/Controller/WalledGardenController.php
index 4aff72beb44..584c264aaf9 100644
--- a/core/Controller/WalledGardenController.php
+++ b/core/Controller/WalledGardenController.php
@@ -32,10 +32,8 @@ class WalledGardenController extends Controller {
/**
* @PublicPage
* @NoCSRFRequired
- *
- * @return Response
*/
- public function get() {
+ public function get(): Response {
$resp = new Response();
$resp->setStatus(Http::STATUS_NO_CONTENT);
return $resp;
diff --git a/core/Controller/WebAuthnController.php b/core/Controller/WebAuthnController.php
index 1aab505f16a..1eab5c79be6 100644
--- a/core/Controller/WebAuthnController.php
+++ b/core/Controller/WebAuthnController.php
@@ -32,29 +32,22 @@ use OC\Authentication\WebAuthn\Manager;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\JSONResponse;
-use OCP\ILogger;
use OCP\IRequest;
use OCP\ISession;
use OCP\Util;
+use Psr\Log\LoggerInterface;
use Webauthn\PublicKeyCredentialRequestOptions;
class WebAuthnController extends Controller {
private const WEBAUTHN_LOGIN = 'webauthn_login';
private const WEBAUTHN_LOGIN_UID = 'webauthn_login_uid';
- /** @var Manager */
- private $webAuthnManger;
+ private Manager $webAuthnManger;
+ private ISession $session;
+ private LoggerInterface $logger;
+ private WebAuthnChain $webAuthnChain;
- /** @var ISession */
- private $session;
-
- /** @var ILogger */
- private $logger;
-
- /** @var WebAuthnChain */
- private $webAuthnChain;
-
- public function __construct($appName, IRequest $request, Manager $webAuthnManger, ISession $session, ILogger $logger, WebAuthnChain $webAuthnChain) {
+ public function __construct($appName, IRequest $request, Manager $webAuthnManger, ISession $session, LoggerInterface $logger, WebAuthnChain $webAuthnChain) {
parent::__construct($appName, $request);
$this->webAuthnManger = $webAuthnManger;