From e3a12b348206adcfbfb0fbc8435ba91240ac2b0a Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Wed, 26 Jan 2022 14:26:58 +0100 Subject: Fix psalm issues in theming app After this change, we are down to only one psalm warning for this app and related to the Application.php. This also make composer psam:update-baseline not silently ignore new errors. Signed-off-by: Carl Schwan --- apps/theming/lib/Controller/IconController.php | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'apps/theming/lib/Controller') diff --git a/apps/theming/lib/Controller/IconController.php b/apps/theming/lib/Controller/IconController.php index b9df2e95622..4235c66a457 100644 --- a/apps/theming/lib/Controller/IconController.php +++ b/apps/theming/lib/Controller/IconController.php @@ -95,13 +95,9 @@ class IconController extends Controller { } $iconFile = $this->imageManager->setCachedImage('icon-' . $app . '-' . str_replace('/', '_',$image), $icon); } - if ($iconFile !== false) { - $response = new FileDisplayResponse($iconFile, Http::STATUS_OK, ['Content-Type' => 'image/svg+xml']); - $response->cacheFor(86400); - return $response; - } - - return new NotFoundResponse(); + $response = new FileDisplayResponse($iconFile, Http::STATUS_OK, ['Content-Type' => 'image/svg+xml']); + $response->cacheFor(86400); + return $response; } /** @@ -111,7 +107,8 @@ class IconController extends Controller { * @NoCSRFRequired * * @param $app string app name - * @return FileDisplayResponse|DataDisplayResponse + * @psalm-return FileDisplayResponse|DataDisplayResponse + * @return Response * @throws \Exception */ public function getFavicon(string $app = 'core'): Response { @@ -129,9 +126,7 @@ class IconController extends Controller { $icon = $this->iconBuilder->getFavicon($app); $iconFile = $this->imageManager->setCachedImage('favIcon-' . $app, $icon); } - if ($iconFile !== false) { - $response = new FileDisplayResponse($iconFile, Http::STATUS_OK, ['Content-Type' => 'image/x-icon']); - } + $response = new FileDisplayResponse($iconFile, Http::STATUS_OK, ['Content-Type' => 'image/x-icon']); } if ($response === null) { $fallbackLogo = \OC::$SERVERROOT . '/core/img/favicon.png'; @@ -148,7 +143,7 @@ class IconController extends Controller { * @NoCSRFRequired * * @param $app string app name - * @return FileDisplayResponse|NotFoundResponse + * @return DataDisplayResponse|FileDisplayResponse * @throws \Exception */ public function getTouchIcon(string $app = 'core'): Response { @@ -165,9 +160,7 @@ class IconController extends Controller { $icon = $this->iconBuilder->getTouchIcon($app); $iconFile = $this->imageManager->setCachedImage('touchIcon-' . $app, $icon); } - if ($iconFile !== false) { - $response = new FileDisplayResponse($iconFile, Http::STATUS_OK, ['Content-Type' => 'image/png']); - } + $response = new FileDisplayResponse($iconFile, Http::STATUS_OK, ['Content-Type' => 'image/png']); } if ($response === null) { $fallbackLogo = \OC::$SERVERROOT . '/core/img/favicon-touch.png'; -- cgit v1.2.3