make phpstan happy

This commit is contained in:
Andrew Dolgov 2022-09-29 20:02:59 +03:00
parent 3545d3ba83
commit 42bc1620b8
No known key found for this signature in database
GPG Key ID: 1A56B4FA25D4AF2A
2 changed files with 14 additions and 9 deletions

View File

@ -550,9 +550,10 @@ class API extends Handler {
foreach ($vfeeds as $feed) { foreach ($vfeeds as $feed) {
if (!implements_interface($feed['sender'], 'IVirtualFeed')) if (!implements_interface($feed['sender'], 'IVirtualFeed'))
continue; continue;
/** @var IVirtualFeed $feed['sender'] */
$unread = $feed['sender']->get_unread($feed['id']); $unread = $feed['sender']->get_unread($feed['id']);
if ($unread || !$unread_only) { if ($unread || !$unread_only) {
$row = [ $row = [
'id' => PluginHost::pfeed_to_feed_id($feed['id']), 'id' => PluginHost::pfeed_to_feed_id($feed['id']),
@ -697,11 +698,14 @@ class API extends Handler {
"skip_first_id_check" => $skip_first_id_check "skip_first_id_check" => $skip_first_id_check
); );
$qfh_ret = [];
if (!$is_cat && is_numeric($feed_id) && $feed_id < PLUGIN_FEED_BASE_INDEX && $feed_id > LABEL_BASE_INDEX) { if (!$is_cat && is_numeric($feed_id) && $feed_id < PLUGIN_FEED_BASE_INDEX && $feed_id > LABEL_BASE_INDEX) {
/** @var IVirtualFeed|false $handler */
$pfeed_id = PluginHost::feed_to_pfeed_id($feed_id); $pfeed_id = PluginHost::feed_to_pfeed_id($feed_id);
/** @var IVirtualFeed|false $handler */
$handler = PluginHost::getInstance()->get_feed_handler($pfeed_id); $handler = PluginHost::getInstance()->get_feed_handler($pfeed_id);
if ($handler) { if ($handler) {
$params = array( $params = array(
"feed" => $feed_id, "feed" => $feed_id,
@ -716,12 +720,12 @@ class API extends Handler {
"check_first_id" => $check_first_id, "check_first_id" => $check_first_id,
"skip_first_id_check" => $skip_first_id_check "skip_first_id_check" => $skip_first_id_check
); );
$qfh_ret = $handler->get_headlines($pfeed_id, $params); $qfh_ret = $handler->get_headlines($pfeed_id, $params);
} }
} else { } else {
$params = array( $params = array(
"feed" => $feed_id, "feed" => $feed_id,
"limit" => $limit, "limit" => $limit,
@ -735,7 +739,7 @@ class API extends Handler {
"check_first_id" => $check_first_id, "check_first_id" => $check_first_id,
"skip_first_id_check" => $skip_first_id_check "skip_first_id_check" => $skip_first_id_check
); );
$qfh_ret = Feeds::_get_headlines($params); $qfh_ret = Feeds::_get_headlines($params);
} }

View File

@ -667,7 +667,7 @@ class Feeds extends Handler_Protected {
} }
Debug::set_enabled(true); Debug::set_enabled(true);
Debug::set_loglevel(Debug::map_loglevel($xdebug)); Debug::set_loglevel((int)Debug::map_loglevel($xdebug));
$feed_id = (int)$_REQUEST["feed_id"]; $feed_id = (int)$_REQUEST["feed_id"];
$do_update = ($_REQUEST["action"] ?? "") == "do_update"; $do_update = ($_REQUEST["action"] ?? "") == "do_update";
@ -969,6 +969,7 @@ class Feeds extends Handler_Protected {
$feed_id = PluginHost::feed_to_pfeed_id($feed); $feed_id = PluginHost::feed_to_pfeed_id($feed);
$handler = PluginHost::getInstance()->get_feed_handler($feed_id); $handler = PluginHost::getInstance()->get_feed_handler($feed_id);
if (implements_interface($handler, 'IVirtualFeed')) { if (implements_interface($handler, 'IVirtualFeed')) {
/** @var IVirtualFeed $handler */
return $handler->get_unread($feed_id); return $handler->get_unread($feed_id);
} else { } else {
return 0; return 0;