Reduce undeeded use of elvis operator ?: (#7204)

This commit is contained in:
Alexandre Alapetite
2025-01-10 08:13:09 +01:00
committed by GitHub
parent 3280ec617f
commit 5368f38753
23 changed files with 71 additions and 74 deletions

View File

@@ -337,7 +337,7 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
FreshRSS_View::prependTitle(_t('sub.feed.title_add') . ' · ');
$catDAO = FreshRSS_Factory::createCategoryDao();
$this->view->categories = $catDAO->listCategories(false) ?: [];
$this->view->categories = $catDAO->listCategories(prePopulateFeeds: false);
$this->view->feed = new FreshRSS_Feed($url);
try {
// We try to get more information about the feed.
@@ -423,12 +423,8 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
}
} else {
$feeds = $feedDAO->listFeedsOrderUpdate(-1);
// Hydrate category for each feed to avoid that each feed has to make an SQL request
$categories = [];
foreach ($catDAO->listCategories(false, false) as $category) {
$categories[$category->id()] = $category;
}
$categories = $catDAO->listCategories(prePopulateFeeds: false, details: false);
foreach ($feeds as $feed) {
$category = $categories[$feed->categoryId()] ?? null;
if ($category !== null) {
@@ -576,7 +572,7 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
$mark_updated_article_unread = $feed->attributeBoolean('mark_updated_article_unread') ?? FreshRSS_Context::userConf()->mark_updated_article_unread;
// For this feed, check existing GUIDs already in database.
$existingHashForGuids = $entryDAO->listHashForFeedGuids($feed->id(), $newGuids) ?: [];
$existingHashForGuids = $entryDAO->listHashForFeedGuids($feed->id(), $newGuids);
/** @var array<string,bool> $newGuids */
$newGuids = [];