diff options
Diffstat (limited to 'p/api')
| -rw-r--r-- | p/api/fever.php | 7 | ||||
| -rw-r--r-- | p/api/greader.php | 13 | ||||
| -rw-r--r-- | p/api/pshb.php | 2 | ||||
| -rw-r--r-- | p/api/query.php | 2 |
4 files changed, 19 insertions, 5 deletions
diff --git a/p/api/fever.php b/p/api/fever.php index 9f4766c9e..ec5af189f 100644 --- a/p/api/fever.php +++ b/p/api/fever.php @@ -407,7 +407,7 @@ final class FeverAPI } /** - * @param array<string> $ids + * @param array<numeric-string> $ids */ private function entriesToIdList(array $ids = []): string { return implode(',', array_values($ids)); @@ -424,6 +424,7 @@ final class FeverAPI } /** + * @param numeric-string $id * @return int|false */ private function setItemAsRead(string $id) { @@ -431,6 +432,7 @@ final class FeverAPI } /** + * @param numeric-string $id * @return int|false */ private function setItemAsUnread(string $id) { @@ -438,6 +440,7 @@ final class FeverAPI } /** + * @param numeric-string $id * @return int|false */ private function setItemAsSaved(string $id) { @@ -445,6 +448,7 @@ final class FeverAPI } /** + * @param numeric-string $id * @return int|false */ private function setItemAsUnsaved(string $id) { @@ -527,6 +531,7 @@ final class FeverAPI /** * TODO replace by a dynamic fetch for id <= $before timestamp + * @return numeric-string */ private function convertBeforeToId(int $beforeTimestamp): string { return $beforeTimestamp == 0 ? '0' : $beforeTimestamp . '000000'; diff --git a/p/api/greader.php b/p/api/greader.php index fe6327cb0..71cf40884 100644 --- a/p/api/greader.php +++ b/p/api/greader.php @@ -31,11 +31,15 @@ require(LIB_PATH . '/lib_rss.php'); //Includes class autoloader $ORIGINAL_INPUT = file_get_contents('php://input', false, null, 0, 1048576) ?: ''; if (PHP_INT_SIZE < 8) { //32-bit + /** @return numeric-string */ function hex2dec(string $hex): string { if (!ctype_xdigit($hex)) return '0'; - return gmp_strval(gmp_init($hex, 16), 10); + $result = gmp_strval(gmp_init($hex, 16), 10); + /** @var numeric-string $result */ + return $result; } } else { //64-bit + /** @return numeric-string */ function hex2dec(string $hex): string { if (!ctype_xdigit($hex)) { return '0'; @@ -794,6 +798,7 @@ final class GReaderAPI { $e_ids[$i] = hex2dec(basename($e_id)); //Strip prefix 'tag:google.com,2005:reader/item/' } } + /** @var array<numeric-string> $e_ids */ $entryDAO = FreshRSS_Factory::createEntryDao(); $entries = $entryDAO->listByIds($e_ids, $order === 'o' ? 'ASC' : 'DESC'); @@ -822,6 +827,7 @@ final class GReaderAPI { $e_ids[$i] = hex2dec(basename($e_id)); //Strip prefix 'tag:google.com,2005:reader/item/' } } + /** @var array<numeric-string> $e_ids */ $entryDAO = FreshRSS_Factory::createEntryDao(); $tagDAO = FreshRSS_Factory::createTagDao(); @@ -943,7 +949,10 @@ final class GReaderAPI { self::badRequest(); } - /** @return never */ + /** + * @param numeric-string $olderThanId + * @return never + */ private static function markAllAsRead(string $streamId, string $olderThanId) { $entryDAO = FreshRSS_Factory::createEntryDao(); if (strpos($streamId, 'feed/') === 0) { diff --git a/p/api/pshb.php b/p/api/pshb.php index 18aa0ebbf..9f5b4822c 100644 --- a/p/api/pshb.php +++ b/p/api/pshb.php @@ -67,7 +67,7 @@ if (empty($users)) { } if (!empty($_REQUEST['hub_mode']) && $_REQUEST['hub_mode'] === 'subscribe') { - $leaseSeconds = empty($_REQUEST['hub_lease_seconds']) ? 0 : (int) $_REQUEST['hub_lease_seconds']; + $leaseSeconds = empty($_REQUEST['hub_lease_seconds']) ? 0 : (int)$_REQUEST['hub_lease_seconds']; if ($leaseSeconds > 60) { $hubJson['lease_end'] = time() + $leaseSeconds; } else { diff --git a/p/api/query.php b/p/api/query.php index 20a2d8cdc..c95a2bf43 100644 --- a/p/api/query.php +++ b/p/api/query.php @@ -82,7 +82,7 @@ foreach (FreshRSS_Context::userConf()->queries as $raw_query) { if (Minz_Request::paramString('order') === '') { Minz_Request::_param('order', $query->getOrder()); } - Minz_Request::_param('state', $query->getState()); + Minz_Request::_param('state', (string)$query->getState()); $search = $query->getSearch()->getRawInput(); // Note: we disallow references to user queries in public user search to avoid sniffing internal user queries |
