diff --git a/classes/api.php b/classes/api.php index 1835d487c..125741c73 100755 --- a/classes/api.php +++ b/classes/api.php @@ -27,7 +27,7 @@ class API extends Handler { ]); } - function before($method) { + function before(string $method): bool { if (parent::before($method)) { header("Content-Type: text/json"); diff --git a/classes/feeds.php b/classes/feeds.php index 22906cb54..0c75215c8 100755 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -2067,7 +2067,12 @@ class Feeds extends Handler_Protected { ->delete_many(); } - static function _update_access_key(int $feed_id, bool $is_cat, int $owner_uid): ?string { + /** + * @param string $feed_id may be a feed ID or tag + * + * @see Handler_Public#generate_syndicated_feed() + */ + static function _update_access_key(string $feed_id, bool $is_cat, int $owner_uid): ?string { $key = ORM::for_table('ttrss_access_keys') ->where('owner_uid', $owner_uid) ->where('feed_id', $feed_id) @@ -2077,7 +2082,12 @@ class Feeds extends Handler_Protected { return self::_get_access_key($feed_id, $is_cat, $owner_uid); } - static function _get_access_key(int $feed_id, bool $is_cat, int $owner_uid): ?string { + /** + * @param string $feed_id may be a feed ID or tag + * + * @see Handler_Public#generate_syndicated_feed() + */ + static function _get_access_key(string $feed_id, bool $is_cat, int $owner_uid): ?string { $key = ORM::for_table('ttrss_access_keys') ->where('owner_uid', $owner_uid) ->where('feed_id', $feed_id) diff --git a/classes/handler.php b/classes/handler.php index 4c79628db..3ee42cedb 100644 --- a/classes/handler.php +++ b/classes/handler.php @@ -1,9 +1,16 @@ */ protected $args; - function __construct($args) { + /** + * @param array $args + */ + function __construct(array $args) { $this->pdo = Db::pdo(); $this->args = $args; } @@ -12,11 +19,11 @@ class Handler implements IHandler { return false; } - function before($method) { + function before(string $method): bool { return true; } - function after() { + function after(): bool { return true; } diff --git a/classes/handler/administrative.php b/classes/handler/administrative.php index f2f5b36ba..533cb3630 100644 --- a/classes/handler/administrative.php +++ b/classes/handler/administrative.php @@ -1,6 +1,6 @@ = UserHelper::ACCESS_LEVEL_ADMIN) { return true; diff --git a/classes/handler/protected.php b/classes/handler/protected.php index 8e9e5ca1d..a15fc0956 100644 --- a/classes/handler/protected.php +++ b/classes/handler/protected.php @@ -1,7 +1,7 @@ get_headlines(PluginHost::feed_to_pfeed_id((int)$feed), $params); } else { user_error("Failed to find handler for plugin feed ID: $feed", E_USER_ERROR); - return false; + return; } } else { @@ -247,7 +251,7 @@ class Handler_Public extends Handler { } } - function getUnread() { + function getUnread(): void { $login = clean($_REQUEST["login"]); $fresh = clean($_REQUEST["fresh"]) == "1"; @@ -265,7 +269,7 @@ class Handler_Public extends Handler { } } - function getProfiles() { + function getProfiles(): void { $login = clean($_REQUEST["login"]); $rv = []; @@ -288,7 +292,7 @@ class Handler_Public extends Handler { print json_encode($rv); } - function logout() { + function logout(): void { if (validate_csrf($_POST["csrf_token"])) { UserHelper::logout(); header("Location: index.php"); @@ -298,7 +302,7 @@ class Handler_Public extends Handler { } } - function rss() { + function rss(): void { $feed = clean($_REQUEST["id"]); $key = clean($_REQUEST["key"]); $is_cat = clean($_REQUEST["is_cat"] ?? false); @@ -333,21 +337,21 @@ class Handler_Public extends Handler { header('HTTP/1.1 403 Forbidden'); } - function updateTask() { + function updateTask(): void { PluginHost::getInstance()->run_hooks(PluginHost::HOOK_UPDATE_TASK); } - function housekeepingTask() { + function housekeepingTask(): void { PluginHost::getInstance()->run_hooks(PluginHost::HOOK_HOUSE_KEEPING); } - function globalUpdateFeeds() { + function globalUpdateFeeds(): void { RPC::updaterandomfeed_real(); PluginHost::getInstance()->run_hooks(PluginHost::HOOK_UPDATE_TASK); } - function login() { + function login(): void { if (!Config::get(Config::SINGLE_USER_MODE)) { $login = clean($_POST["login"]); @@ -403,12 +407,12 @@ class Handler_Public extends Handler { } } - function index() { + function index(): void { header("Content-Type: text/plain"); print Errors::to_json(Errors::E_UNKNOWN_METHOD); } - function forgotpass() { + function forgotpass(): void { startup_gettext(); session_start(); @@ -587,7 +591,7 @@ class Handler_Public extends Handler { print ""; } - function dbupdate() { + function dbupdate(): void { startup_gettext(); if (!Config::get(Config::SINGLE_USER_MODE) && ($_SESSION["access_level"] ?? 0) < 10) { @@ -730,7 +734,7 @@ class Handler_Public extends Handler {