From f3760f138dcbaf7a2190336a0378cf1b2190c9f5 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Mon, 17 Apr 2023 08:30:21 +0200 Subject: Complete PHPStan Level 6 (#5305) * Complete PHPStan Level 6 Fix https://github.com/FreshRSS/FreshRSS/issues/4112 And initiate PHPStan Level 7 * PHPStan Level 6 for tests * Use phpstan/phpstan-phpunit * Update to PHPStan version 1.10 * Fix mixed bug * Fix mixed return bug * Fix paginator bug * Fix FreshRSS_UserConfiguration * A couple more Minz_Configuration bug fixes * A few trivial PHPStan Level 7 fixes * A few more simple PHPStan Level 7 * More files passing PHPStan Level 7 Add interface to replace removed class from https://github.com/FreshRSS/FreshRSS/pull/5251 * A few more PHPStan Level 7 preparations * A few last details --- app/Controllers/indexController.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'app/Controllers/indexController.php') diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php index 17aee3585..64371c530 100644 --- a/app/Controllers/indexController.php +++ b/app/Controllers/indexController.php @@ -58,10 +58,10 @@ class FreshRSS_index_Controller extends FreshRSS_ActionController { FreshRSS_Context::$id_max = time() . '000000'; - $this->view->callbackBeforeFeeds = function ($view) { + $this->view->callbackBeforeFeeds = function (FreshRSS_View $view) { try { $tagDAO = FreshRSS_Factory::createTagDao(); - $view->tags = $tagDAO->listTags(true); + $view->tags = $tagDAO->listTags(true) ?: []; $view->nbUnreadTags = 0; foreach ($view->tags as $tag) { $view->nbUnreadTags += $tag->nbUnread(); @@ -71,7 +71,7 @@ class FreshRSS_index_Controller extends FreshRSS_ActionController { } }; - $this->view->callbackBeforeEntries = function ($view) { + $this->view->callbackBeforeEntries = function (FreshRSS_View $view) { try { FreshRSS_Context::$number++; //+1 for articles' page $view->entries = FreshRSS_index_Controller::listEntriesByContext(); @@ -83,7 +83,7 @@ class FreshRSS_index_Controller extends FreshRSS_ActionController { } }; - $this->view->callbackBeforePagination = function ($view, $nbEntries, $lastEntry) { + $this->view->callbackBeforePagination = function (?FreshRSS_View $view, int $nbEntries, FreshRSS_Entry $lastEntry) { if ($nbEntries >= FreshRSS_Context::$number) { //We have enough entries: we discard the last one to use it for the next articles' page ob_clean(); @@ -170,7 +170,7 @@ class FreshRSS_index_Controller extends FreshRSS_ActionController { // No layout for RSS output. $this->view->rss_url = PUBLIC_TO_INDEX_PATH . '/' . (empty($_SERVER['QUERY_STRING']) ? '' : '?' . $_SERVER['QUERY_STRING']); $this->view->rss_title = FreshRSS_Context::$name . ' | ' . FreshRSS_View::title(); - $this->view->_layout(false); + $this->view->_layout(null); header('Content-Type: application/rss+xml; charset=utf-8'); } @@ -238,7 +238,7 @@ class FreshRSS_index_Controller extends FreshRSS_ActionController { } // No layout for OPML output. - $this->view->_layout(false); + $this->view->_layout(null); header('Content-Type: application/xml; charset=utf-8'); } -- cgit v1.2.3