diff options
| author | 2024-06-09 20:32:12 +0200 | |
|---|---|---|
| committer | 2024-06-09 20:32:12 +0200 | |
| commit | 5b28a35003a015e29770094932157f13a3f7f5c0 (patch) | |
| tree | 4cbe4100379ca0d148115ad31f5a1c0c95ff7c80 /p/api/greader.php | |
| parent | e98c57841b843ed881f06ce6ed1c9c89942c27b8 (diff) | |
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
Diffstat (limited to 'p/api/greader.php')
| -rw-r--r-- | p/api/greader.php | 13 |
1 files changed, 11 insertions, 2 deletions
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) { |
