From 5b28a35003a015e29770094932157f13a3f7f5c0 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 9 Jun 2024 20:32:12 +0200 Subject: Pass PHPStan level 9 (#6544) * More PHPStan * More, passing * 4 more files * Update to PHPStan 1.11.4 Needed for fixed bug: Consider numeric-string types after string concat https://github.com/phpstan/phpstan/releases/tag/1.11.4 * Pass PHPStan level 9 Start tracking booleansInConditions * Fix mark as read * Fix doctype * ctype_digit --- p/api/greader.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'p/api/greader.php') 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 $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 $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) { -- cgit v1.2.3