From 5c952e83fcff7960a6e9ec5241a2f0c3fb215151 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Tue, 2 Mar 2021 20:36:04 +0100 Subject: Pimp sharingcheckmiddleware Reported by psalm Signed-off-by: Roeland Jago Douma --- .../lib/Middleware/SharingCheckMiddleware.php | 25 ++++++++-------------- 1 file changed, 9 insertions(+), 16 deletions(-) (limited to 'apps/files_sharing/lib/Middleware') diff --git a/apps/files_sharing/lib/Middleware/SharingCheckMiddleware.php b/apps/files_sharing/lib/Middleware/SharingCheckMiddleware.php index c58496a46d7..335b0908a98 100644 --- a/apps/files_sharing/lib/Middleware/SharingCheckMiddleware.php +++ b/apps/files_sharing/lib/Middleware/SharingCheckMiddleware.php @@ -1,4 +1,6 @@ isSharingEnabled()) { throw new NotFoundException('Sharing is disabled.'); } @@ -110,10 +103,10 @@ class SharingCheckMiddleware extends Middleware { * @param Controller $controller * @param string $methodName * @param \Exception $exception - * @return NotFoundResponse + * @return Response * @throws \Exception */ - public function afterException($controller, $methodName, \Exception $exception) { + public function afterException($controller, $methodName, \Exception $exception): Response { if (is_a($exception, NotFoundException::class)) { return new NotFoundResponse(); } @@ -129,7 +122,7 @@ class SharingCheckMiddleware extends Middleware { * Checks for externalshares controller * @return bool */ - private function externalSharesChecks() { + private function externalSharesChecks(): bool { if (!$this->reflector->hasAnnotation('NoIncomingFederatedSharingRequired') && $this->config->getAppValue('files_sharing', 'incoming_server2server_share_enabled', 'yes') !== 'yes') { return false; @@ -147,7 +140,7 @@ class SharingCheckMiddleware extends Middleware { * Check whether sharing is enabled * @return bool */ - private function isSharingEnabled() { + private function isSharingEnabled(): bool { // FIXME: This check is done here since the route is globally defined and not inside the files_sharing app // Check whether the sharing application is enabled if (!$this->appManager->isEnabledForUser($this->appName)) { -- cgit v1.2.3