A free, self-hostable news aggregator…
PHPStan Level 7 for FreshRSS_UserQuery (#5319)
Alexandre Alapetite2208974c00d3
diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.phpindex 76675f545..7611d93b2 100644--- a/app/Controllers/configureController.php+++ b/app/Controllers/configureController.php@@ -294,7 +294,7 @@ class FreshRSS_configure_Controller extends FreshRSS_ActionController {$tag_dao = FreshRSS_Factory::createTagDao();if (Minz_Request::isPost()) {- /** @var array<int,array<string,string>> $params */+ /** @var array<int,array{'get'?:string,'name'?:string,'order'?:string,'search'?:string,'state'?:int,'url'?:string}> $params */$params = Minz_Request::paramArray('queries');$queries = [];diff --git a/app/Models/UserConfiguration.php b/app/Models/UserConfiguration.phpindex 173ab78b9..30095af34 100644--- a/app/Models/UserConfiguration.php+++ b/app/Models/UserConfiguration.php@@ -39,7 +39,7 @@* @property bool $onread_jump_next* @property string $passwordHash* @property int $posts_per_page- * @property array<array<string,string|int>> $queries+ * @property array<array{'get'?:string,'name'?:string,'order'?:string,'search'?:string,'state'?:int,'url'?:string}> $queries* @property bool $reading_confirm* @property int $since_hours_posts_per_rss* @property bool $show_fav_unreaddiff --git a/app/Models/UserQuery.php b/app/Models/UserQuery.phpindex f0d809378..f2301ff26 100644--- a/app/Models/UserQuery.php+++ b/app/Models/UserQuery.php@@ -34,7 +34,7 @@ class FreshRSS_UserQuery {private $tag_dao;/**- * @param array<string,string|int> $query+ * @param array{'get'?:string,'name'?:string,'order'?:string,'search'?:string,'state'?:int,'url'?:string} $query*/public function __construct(array $query, FreshRSS_FeedDAO $feed_dao = null, FreshRSS_CategoryDAO $category_dao = null, FreshRSS_TagDAO $tag_dao = null) {$this->category_dao = $category_dao;@@ -70,7 +70,7 @@ class FreshRSS_UserQuery {/*** Convert the current object to an array.*- * @return array<string,string|int>+ * @return array{'get'?:string,'name'?:string,'order'?:string,'search'?:string,'state'?:int,'url'?:string}*/public function toArray(): array {return array_filter(array(diff --git a/app/layout/nav_menu.phtml b/app/layout/nav_menu.phtmlindex 8eb8d4a62..095b0a787 100644--- a/app/layout/nav_menu.phtml+++ b/app/layout/nav_menu.phtml@@ -85,7 +85,7 @@<?php foreach (FreshRSS_Context::$user_conf->queries as $raw_query): ?><li class="item query"><?php if (!empty($raw_query['url'])): ?>- <a href="<?= $raw_query['url'] ?>"><?= $raw_query['name'] ?></a>+ <a href="<?= $raw_query['url'] ?>"><?= $raw_query['name'] ?? $raw_query['url'] ?></a><?php else: ?><?php $query = new FreshRSS_UserQuery($raw_query); ?><a href="<?= $query->getUrl() ?>"><?= $query->getName() ?></a>diff --git a/tests/phpstan-next.txt b/tests/phpstan-next.txtindex 878be4f8c..308edc346 100644--- a/tests/phpstan-next.txt+++ b/tests/phpstan-next.txt@@ -22,7 +22,6 @@./app/Models/StatsDAO.php./app/Models/TagDAO.php./app/Models/Themes.php-./app/Models/UserQuery.php./app/Services/ExportService.php./app/Services/ImportService.php./app/views/helpers/logs_pagination.phtml