From dd42ec60ef9a488efed0f05a31c3f9dc18621000 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 10 Oct 2021 16:07:06 +0200 Subject: [PATCH] phpstan fixes --- Controller/ApiController.php | 14 +++++++++++++- Controller/BackendController.php | 4 ++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Controller/ApiController.php b/Controller/ApiController.php index fb3f91c..d559c11 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -197,7 +197,7 @@ final class ApiController extends Controller */ private function createView(Template $template, RequestAbstract $request, ResponseAbstract $response) : View { - /** @var array> $tcoll */ + /** @var array $tcoll */ $tcoll = []; $files = $template->getSource()->getSources(); @@ -237,6 +237,10 @@ final class ApiController extends Controller $tcoll['template'] = $tMedia; break; case StringUtils::endsWith($lowerPath, '.css'): + if (!isset($tcoll['css'])) { + $tcoll['css'] = []; + } + $tcoll['css'][$tMedia->name] = $tMedia; break; case StringUtils::endsWith($lowerPath, '.js'): @@ -244,9 +248,17 @@ final class ApiController extends Controller break; case StringUtils::endsWith($lowerPath, '.sqlite'): case StringUtils::endsWith($lowerPath, '.db'): + if (!isset($tcoll['db'])) { + $tcoll['db'] = []; + } + $tcoll['db'][$tMedia->name] = $tMedia; break; default: + if (!isset($tcoll['other'])) { + $tcoll['other'] = []; + } + $tcoll['other'][$tMedia->name] = $tMedia; } } diff --git a/Controller/BackendController.php b/Controller/BackendController.php index 0343e1f..f02788e 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -178,6 +178,10 @@ final class BackendController extends Controller } elseif (StringUtils::endsWith($lowerPath, '.js')) { $tcoll['js'] = $tMedia; } elseif (StringUtils::endsWith($lowerPath, '.sqlite') || StringUtils::endsWith($lowerPath, '.db')) { + if (!isset($tcoll['db'])) { + $tcoll['db'] = []; + } + $tcoll['db'][] = $tMedia; } }