diff --git a/settings/Controller/AuthSettingsController.php b/settings/Controller/AuthSettingsController.php index d1ce567afb..7b68fc4c28 100644 --- a/settings/Controller/AuthSettingsController.php +++ b/settings/Controller/AuthSettingsController.php @@ -76,11 +76,11 @@ class AuthSettingsController extends Controller { * @NoAdminRequired * @NoSubadminRequired * - * @return JSONResponse + * @return JSONResponse|array */ public function index() { $user = $this->userManager->get($this->uid); - if (is_null($user)) { + if ($user === null) { return []; } $tokens = $this->tokenProvider->getTokenByUser($user); @@ -147,6 +147,9 @@ class AuthSettingsController extends Controller { ]); } + /** + * @return JSONResponse + */ private function getServiceNotAvailableResponse() { $resp = new JSONResponse(); $resp->setStatus(Http::STATUS_SERVICE_UNAVAILABLE); @@ -172,7 +175,7 @@ class AuthSettingsController extends Controller { * @NoAdminRequired * @NoSubadminRequired * - * @return JSONResponse + * @return array */ public function destroy($id) { $user = $this->userManager->get($this->uid); @@ -190,9 +193,10 @@ class AuthSettingsController extends Controller { * * @param int $id * @param array $scope + * @return array */ public function update($id, array $scope) { - $token = $this->tokenProvider->getTokenById($id); + $token = $this->tokenProvider->getTokenById((string)$id); $token->setScope([ 'filesystem' => $scope['filesystem'] ]); diff --git a/settings/Controller/CertificateController.php b/settings/Controller/CertificateController.php index 1cf9e03eff..c5f7e89f3f 100644 --- a/settings/Controller/CertificateController.php +++ b/settings/Controller/CertificateController.php @@ -72,7 +72,7 @@ class CertificateController extends Controller { * * @NoAdminRequired * @NoSubadminRequired - * @return array + * @return DataResponse */ public function addPersonalRootCertificate() { return $this->addCertificate($this->userCertificateManager); @@ -114,7 +114,7 @@ class CertificateController extends Controller { $headers ); } catch (\Exception $e) { - return new DataResponse('An error occurred.', Http::STATUS_UNPROCESSABLE_ENTITY, $headers); + return new DataResponse(['An error occurred.'], Http::STATUS_UNPROCESSABLE_ENTITY, $headers); } } @@ -129,7 +129,7 @@ class CertificateController extends Controller { public function removePersonalRootCertificate($certificateIdentifier) { if ($this->isCertificateImportAllowed() === false) { - return new DataResponse('Individual certificate management disabled', Http::STATUS_FORBIDDEN); + return new DataResponse(['Individual certificate management disabled'], Http::STATUS_FORBIDDEN); } $this->userCertificateManager->removeCertificate($certificateIdentifier); @@ -156,7 +156,7 @@ class CertificateController extends Controller { /** * Add a new personal root certificate to the system's trust store * - * @return array + * @return DataResponse */ public function addSystemRootCertificate() { return $this->addCertificate($this->systemCertificateManager); @@ -171,7 +171,7 @@ class CertificateController extends Controller { public function removeSystemRootCertificate($certificateIdentifier) { if ($this->isCertificateImportAllowed() === false) { - return new DataResponse('Individual certificate management disabled', Http::STATUS_FORBIDDEN); + return new DataResponse(['Individual certificate management disabled'], Http::STATUS_FORBIDDEN); } $this->systemCertificateManager->removeCertificate($certificateIdentifier); diff --git a/settings/Controller/ChangePasswordController.php b/settings/Controller/ChangePasswordController.php index cb1a97386a..e0129af50f 100644 --- a/settings/Controller/ChangePasswordController.php +++ b/settings/Controller/ChangePasswordController.php @@ -22,14 +22,15 @@ namespace OC\Settings\Controller; use OC\HintException; +use OC\User\Manager as UserManager; +use OC\Group\Manager as GroupManager; +use OC\User\Session; use OCP\App\IAppManager; use OCP\AppFramework\Controller; use OCP\AppFramework\Http\JSONResponse; -use OCP\IGroupManager; use OCP\IL10N; use OCP\IRequest; use OCP\IUser; -use OCP\IUserManager; use OCP\IUserSession; class ChangePasswordController extends Controller { @@ -37,16 +38,16 @@ class ChangePasswordController extends Controller { /** @var string */ private $userId; - /** @var IUserManager */ + /** @var UserManager */ private $userManager; /** @var IL10N */ private $l; - /** @var IGroupManager */ + /** @var GroupManager */ private $groupManager; - /** @var IUserSession */ + /** @var Session */ private $userSession; /** @var IAppManager */ @@ -58,18 +59,18 @@ class ChangePasswordController extends Controller { * @param string $appName * @param IRequest $request * @param $userId - * @param IUserManager $userManager + * @param UserManager $userManager * @param IUserSession $userSession - * @param IGroupManager $groupManager + * @param GroupManager $groupManager * @param IAppManager $appManager * @param IL10N $l */ public function __construct($appName, IRequest $request, $userId, - IUserManager $userManager, + UserManager $userManager, IUserSession $userSession, - IGroupManager $groupManager, + GroupManager $groupManager, IAppManager $appManager, IL10N $l) { parent::__construct($appName, $request); diff --git a/tests/Core/Controller/ChangePasswordControllerTest.php b/tests/Core/Controller/ChangePasswordControllerTest.php index c426bae997..ea3abb58e2 100644 --- a/tests/Core/Controller/ChangePasswordControllerTest.php +++ b/tests/Core/Controller/ChangePasswordControllerTest.php @@ -50,9 +50,9 @@ class ChangePasswordControllerTest extends \Test\TestCase { public function setUp() { parent::setUp(); - $this->userManager = $this->createMock(IUserManager::class); + $this->userManager = $this->createMock(\OC\User\Manager::class); $this->userSession = $this->createMock(Session::class); - $this->groupManager = $this->createMock(IGroupManager::class); + $this->groupManager = $this->createMock(\OC\Group\Manager::class); $this->appManager = $this->createMock(IAppManager::class); $this->l = $this->createMock(IL10N::class); $this->l->method('t')->will($this->returnArgument(0));