aboutsummaryrefslogtreecommitdiffstats
path: root/apps/theming/lib/Controller/IconController.php
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2022-01-26 14:26:58 +0100
committerCarl Schwan <carl@carlschwan.eu>2022-01-26 14:26:58 +0100
commite3a12b348206adcfbfb0fbc8435ba91240ac2b0a (patch)
treea95db61139c9399dd51c10bed7faaeee42919c30 /apps/theming/lib/Controller/IconController.php
parenta145edd00db95135bee6f584e21301267fb5ac16 (diff)
downloadnextcloud-server-e3a12b348206adcfbfb0fbc8435ba91240ac2b0a.tar.gz
nextcloud-server-e3a12b348206adcfbfb0fbc8435ba91240ac2b0a.zip
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 <carl@carlschwan.eu>
Diffstat (limited to 'apps/theming/lib/Controller/IconController.php')
-rw-r--r--apps/theming/lib/Controller/IconController.php23
1 files changed, 8 insertions, 15 deletions
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';