1
0
mirror of https://github.com/chylex/Nextcloud-News.git synced 2025-05-11 13:34:06 +02:00

fixes done by psalm

Signed-off-by: Benjamin Brahmer <info@b-brahmer.de>
This commit is contained in:
Benjamin Brahmer 2021-01-06 20:16:33 +01:00 committed by Sean Molenaar
parent cc582c5dc8
commit 7180e11bdb
22 changed files with 188 additions and 78 deletions

View File

@ -54,7 +54,12 @@ class LegacyConfig
$this->updateInterval = 3600; $this->updateInterval = 3600;
} }
public function read($configPath, $createIfNotExists = false) /**
* @param false $createIfNotExists
*
* @return void
*/
public function read($configPath, bool $createIfNotExists = false)
{ {
if ($this->fileSystem === null) { if ($this->fileSystem === null) {
return; return;

View File

@ -49,9 +49,9 @@ class ApiController extends BaseApiController
} }
/** /**
* @return IUser * @return IUser|null
*/ */
protected function getUser() protected function getUser(): ?IUser
{ {
if ($this->userSession === null) { if ($this->userSession === null) {
throw new NotLoggedInException(); throw new NotLoggedInException();

View File

@ -48,9 +48,9 @@ class Controller extends BaseController
} }
/** /**
* @return IUser * @return IUser|null
*/ */
protected function getUser() protected function getUser(): ?IUser
{ {
if ($this->userSession === null) { if ($this->userSession === null) {
throw new NotLoggedInException(); throw new NotLoggedInException();

View File

@ -56,8 +56,12 @@ class FolderController extends Controller
/** /**
* @NoAdminRequired * @NoAdminRequired
*
* @return array[]
*
* @psalm-return array{folders: array}
*/ */
public function index() public function index(): array
{ {
$folders = $this->folderService->findAllForUser($this->getUserId()); $folders = $this->folderService->findAllForUser($this->getUserId());
return ['folders' => $this->serialize($folders)]; return ['folders' => $this->serialize($folders)];

View File

@ -109,6 +109,11 @@ class ItemApiController extends ApiController
} }
/**
* @return JSONResponse|array
*
* @psalm-return JSONResponse|array<empty, empty>
*/
private function setRead(bool $isRead, int $itemId) private function setRead(bool $isRead, int $itemId)
{ {
try { try {
@ -151,6 +156,11 @@ class ItemApiController extends ApiController
} }
/**
* @return JSONResponse|array
*
* @psalm-return JSONResponse|array<empty, empty>
*/
private function setStarred(bool $isStarred, int $feedId, string $guidHash) private function setStarred(bool $isStarred, int $feedId, string $guidHash)
{ {
try { try {
@ -202,18 +212,22 @@ class ItemApiController extends ApiController
/** /**
* @NoAdminRequired * @NoAdminRequired
*
* @NoCSRFRequired * @NoCSRFRequired
*
* @CORS * @CORS
* *
* @param int $newestItemId * @param int $newestItemId
*
* @return void
*/ */
public function readAll(int $newestItemId) public function readAll(int $newestItemId): void
{ {
$this->oldItemService->readAll($newestItemId, $this->getUserId()); $this->oldItemService->readAll($newestItemId, $this->getUserId());
} }
private function setMultipleRead(bool $isRead, array $items) private function setMultipleRead(bool $isRead, array $items): void
{ {
foreach ($items as $id) { foreach ($items as $id) {
try { try {
@ -227,12 +241,16 @@ class ItemApiController extends ApiController
/** /**
* @NoAdminRequired * @NoAdminRequired
*
* @NoCSRFRequired * @NoCSRFRequired
*
* @CORS * @CORS
* *
* @param int[] $items item ids * @param int[] $items item ids
*
* @return void
*/ */
public function readMultiple(array $items) public function readMultiple(array $items): void
{ {
$this->setMultipleRead(true, $items); $this->setMultipleRead(true, $items);
} }
@ -240,12 +258,16 @@ class ItemApiController extends ApiController
/** /**
* @NoAdminRequired * @NoAdminRequired
*
* @NoCSRFRequired * @NoCSRFRequired
*
* @CORS * @CORS
* *
* @param int[] $items item ids * @param int[] $items item ids
*
* @return void
*/ */
public function unreadMultiple(array $items) public function unreadMultiple(array $items): void
{ {
$this->setMultipleRead(false, $items); $this->setMultipleRead(false, $items);
} }
@ -254,8 +276,10 @@ class ItemApiController extends ApiController
/** /**
* @param bool $isStarred * @param bool $isStarred
* @param array $items * @param array $items
*
* @return void
*/ */
private function setMultipleStarred(bool $isStarred, array $items) private function setMultipleStarred(bool $isStarred, array $items): void
{ {
foreach ($items as $item) { foreach ($items as $item) {
try { try {
@ -274,12 +298,16 @@ class ItemApiController extends ApiController
/** /**
* @NoAdminRequired * @NoAdminRequired
*
* @NoCSRFRequired * @NoCSRFRequired
*
* @CORS * @CORS
* *
* @param int[] $items item ids * @param int[] $items item ids
*
* @return void
*/ */
public function starMultiple(array $items) public function starMultiple(array $items): void
{ {
$this->setMultipleStarred(true, $items); $this->setMultipleStarred(true, $items);
} }
@ -287,12 +315,16 @@ class ItemApiController extends ApiController
/** /**
* @NoAdminRequired * @NoAdminRequired
*
* @NoCSRFRequired * @NoCSRFRequired
*
* @CORS * @CORS
* *
* @param array $items item ids * @param array $items item ids
*
* @return void
*/ */
public function unstarMultiple(array $items) public function unstarMultiple(array $items): void
{ {
$this->setMultipleStarred(false, $items); $this->setMultipleStarred(false, $items);
} }

View File

@ -249,8 +249,10 @@ class ItemController extends Controller
* @NoAdminRequired * @NoAdminRequired
* *
* @param int[] $itemIds item ids * @param int[] $itemIds item ids
*
* @return void
*/ */
public function readMultiple($itemIds) public function readMultiple($itemIds): void
{ {
foreach ($itemIds as $id) { foreach ($itemIds as $id) {
try { try {

View File

@ -189,6 +189,8 @@ class PageController extends Controller
* @NoAdminRequired * @NoAdminRequired
* *
* @param string $lang * @param string $lang
*
* @return Http\JSONResponse|array
*/ */
public function explore(string $lang) public function explore(string $lang)
{ {

View File

@ -199,7 +199,7 @@ class Item extends Entity implements IAPI, \JsonSerializable
return $this->enclosureMime; return $this->enclosureMime;
} }
public function getFeedId(): string public function getFeedId(): int
{ {
return $this->feedId; return $this->feedId;
} }

View File

@ -50,10 +50,10 @@ class ItemMapper extends Mapper
} }
private function makeSelectQuery( private function makeSelectQuery(
$prependTo = '', string $prependTo = '',
$oldestFirst = false, $oldestFirst = false,
$distinctFingerprint = false $distinctFingerprint = false
) { ): string {
if ($oldestFirst) { if ($oldestFirst) {
$ordering = 'ASC'; $ordering = 'ASC';
} else { } else {
@ -95,7 +95,7 @@ class ItemMapper extends Mapper
return $sql; return $sql;
} }
private function buildSearchQueryPart(array $search = []) private function buildSearchQueryPart(array $search = []): string
{ {
return str_repeat('AND `items`.`search_index` LIKE ? ', count($search)); return str_repeat('AND `items`.`search_index` LIKE ? ', count($search));
} }
@ -128,7 +128,7 @@ class ItemMapper extends Mapper
return $this->findEntity($sql, [$userId, $id]); return $this->findEntity($sql, [$userId, $id]);
} }
public function starredCount(string $userId) public function starredCount(string $userId): int
{ {
$sql = 'SELECT COUNT(*) AS size FROM `*PREFIX*news_items` `items` ' . $sql = 'SELECT COUNT(*) AS size FROM `*PREFIX*news_items` `items` ' .
'JOIN `*PREFIX*news_feeds` `feeds` ' . 'JOIN `*PREFIX*news_feeds` `feeds` ' .
@ -149,7 +149,7 @@ class ItemMapper extends Mapper
} }
public function readAll(int $highestItemId, $time, string $userId) public function readAll(int $highestItemId, string $time, string $userId): void
{ {
$sql = 'UPDATE `*PREFIX*news_items` ' . $sql = 'UPDATE `*PREFIX*news_items` ' .
'SET unread = ? ' . 'SET unread = ? ' .
@ -164,7 +164,7 @@ class ItemMapper extends Mapper
} }
public function readFolder(?int $folderId, $highestItemId, $time, $userId) public function readFolder(?int $folderId, int $highestItemId, string $time, string $userId): void
{ {
$folderWhere = is_null($folderId) ? 'IS' : '='; $folderWhere = is_null($folderId) ? 'IS' : '=';
$sql = 'UPDATE `*PREFIX*news_items` ' . $sql = 'UPDATE `*PREFIX*news_items` ' .
@ -182,7 +182,7 @@ class ItemMapper extends Mapper
} }
public function readFeed($feedId, $highestItemId, $time, $userId) public function readFeed(int $feedId, int $highestItemId, string $time, string $userId): void
{ {
$sql = 'UPDATE `*PREFIX*news_items` ' . $sql = 'UPDATE `*PREFIX*news_items` ' .
'SET unread = ? ' . 'SET unread = ? ' .
@ -200,7 +200,7 @@ class ItemMapper extends Mapper
} }
private function getOperator($oldestFirst) private function getOperator($oldestFirst): string
{ {
if ($oldestFirst) { if ($oldestFirst) {
return '>'; return '>';
@ -210,7 +210,7 @@ class ItemMapper extends Mapper
} }
public function findAllNew($updatedSince, $type, $showAll, $userId) public function findAllNew(int $updatedSince, int $type, bool $showAll, string $userId): array
{ {
$sql = $this->buildStatusQueryPart($showAll, $type); $sql = $this->buildStatusQueryPart($showAll, $type);
@ -221,7 +221,7 @@ class ItemMapper extends Mapper
} }
public function findAllNewFolder(?int $id, $updatedSince, $showAll, $userId) public function findAllNewFolder(?int $id, int $updatedSince, bool $showAll, string $userId): array
{ {
$sql = $this->buildStatusQueryPart($showAll); $sql = $this->buildStatusQueryPart($showAll);
@ -234,7 +234,7 @@ class ItemMapper extends Mapper
} }
public function findAllNewFeed($id, $updatedSince, $showAll, $userId) public function findAllNewFeed(?int $id, int $updatedSince, bool $showAll, string $userId): array
{ {
$sql = $this->buildStatusQueryPart($showAll); $sql = $this->buildStatusQueryPart($showAll);
@ -246,7 +246,10 @@ class ItemMapper extends Mapper
} }
private function findEntitiesIgnoringNegativeLimit($sql, $params, $limit): array /**
* @param (int|mixed|null)[] $params
*/
private function findEntitiesIgnoringNegativeLimit($sql, array $params, $limit): array
{ {
// ignore limit if negative to offer a way to return all feeds // ignore limit if negative to offer a way to return all feeds
if ($limit >= 0) { if ($limit >= 0) {
@ -258,14 +261,14 @@ class ItemMapper extends Mapper
public function findAllFeed( public function findAllFeed(
$id, ?int $id,
$limit, int $limit,
$offset, int $offset,
$showAll, bool $showAll,
$oldestFirst, bool $oldestFirst,
$userId, string $userId,
$search = [] array $search = []
) { ): array {
$params = [$userId]; $params = [$userId];
$params = array_merge($params, $this->buildLikeParameters($search)); $params = array_merge($params, $this->buildLikeParameters($search));
$params[] = $id; $params[] = $id;
@ -286,13 +289,13 @@ class ItemMapper extends Mapper
public function findAllFolder( public function findAllFolder(
?int $id, ?int $id,
$limit, int $limit,
$offset, int $offset,
$showAll, bool $showAll,
$oldestFirst, bool $oldestFirst,
$userId, string $userId,
$search = [] array $search = []
) { ): array {
$params = [$userId]; $params = [$userId];
$params = array_merge($params, $this->buildLikeParameters($search)); $params = array_merge($params, $this->buildLikeParameters($search));
$params[] = $id; $params[] = $id;
@ -311,14 +314,17 @@ class ItemMapper extends Mapper
} }
/**
* @param string[] $search
*/
public function findAllItems( public function findAllItems(
$limit, int $limit,
$offset, int $offset,
$type, int $type,
$showAll, bool $showAll,
$oldestFirst, bool $oldestFirst,
$userId, string $userId,
$search = [] array $search = []
): array { ): array {
$params = [$userId]; $params = [$userId];
$params = array_merge($params, $this->buildLikeParameters($search)); $params = array_merge($params, $this->buildLikeParameters($search));
@ -337,7 +343,7 @@ class ItemMapper extends Mapper
} }
public function findAllUnreadOrStarred($userId) public function findAllUnreadOrStarred(string $userId): array
{ {
$params = [$userId, true, true]; $params = [$userId, true, true];
$sql = 'AND (`items`.`unread` = ? OR `items`.`starred` = ?) '; $sql = 'AND (`items`.`unread` = ? OR `items`.`starred` = ?) ';
@ -370,6 +376,8 @@ class ItemMapper extends Mapper
* starred items * starred items
* *
* @param int $threshold the number of items that should be deleted * @param int $threshold the number of items that should be deleted
*
* @return void
*/ */
public function deleteReadOlderThanThreshold($threshold) public function deleteReadOlderThanThreshold($threshold)
{ {
@ -417,7 +425,7 @@ class ItemMapper extends Mapper
} }
public function getNewestItemId($userId) public function getNewestItemId(string $userId): int
{ {
$sql = 'SELECT MAX(`items`.`id`) AS `max_id` ' . $sql = 'SELECT MAX(`items`.`id`) AS `max_id` ' .
'FROM `*PREFIX*news_items` `items` ' . 'FROM `*PREFIX*news_items` `items` ' .
@ -434,8 +442,13 @@ class ItemMapper extends Mapper
/** /**
* Returns a list of ids and userid of all items * Returns a list of ids and userid of all items
*
* @param int|null $limit
* @param int|null $offset
*
* @return array|false
*/ */
public function findAllIds($limit = null, $offset = null) public function findAllIds(?int $limit = null, ?int $offset = null)
{ {
$sql = 'SELECT `id` FROM `*PREFIX*news_items`'; $sql = 'SELECT `id` FROM `*PREFIX*news_items`';
return $this->execute($sql, [], $limit, $offset)->fetchAll(); return $this->execute($sql, [], $limit, $offset)->fetchAll();
@ -443,8 +456,10 @@ class ItemMapper extends Mapper
/** /**
* Update search indices of all items * Update search indices of all items
*
* @return void
*/ */
public function updateSearchIndices() public function updateSearchIndices(): void
{ {
// update indices in steps to prevent memory issues on larger systems // update indices in steps to prevent memory issues on larger systems
$step = 1000; // update 1000 items at a time $step = 1000; // update 1000 items at a time
@ -460,7 +475,7 @@ class ItemMapper extends Mapper
} }
} }
private function updateSearchIndex(array $items = []) private function updateSearchIndex(array $items = []): void
{ {
foreach ($items as $row) { foreach ($items as $row) {
$sql = 'SELECT * FROM `*PREFIX*news_items` WHERE `id` = ?'; $sql = 'SELECT * FROM `*PREFIX*news_items` WHERE `id` = ?';
@ -471,7 +486,10 @@ class ItemMapper extends Mapper
} }
} }
public function readItem($itemId, $isRead, $lastModified, $userId) /**
* @return void
*/
public function readItem(int $itemId, bool $isRead, string $lastModified, string $userId)
{ {
$item = $this->find($userId, $itemId); $item = $this->find($userId, $itemId);

View File

@ -102,7 +102,7 @@ class ItemMapperV2 extends NewsMapperV2
* @param int $feedId ID of the feed * @param int $feedId ID of the feed
* @param string $guidHash hash to find with * @param string $guidHash hash to find with
* *
* @return Item|Entity * @return Item
* *
* @throws DoesNotExistException * @throws DoesNotExistException
* @throws MultipleObjectsReturnedException * @throws MultipleObjectsReturnedException

View File

@ -36,6 +36,8 @@ class ItemMapper extends \OCA\News\Db\ItemMapper
* starred items * starred items
* *
* @param int $threshold the number of items that should be deleted * @param int $threshold the number of items that should be deleted
*
* @return void
*/ */
public function deleteReadOlderThanThreshold($threshold) public function deleteReadOlderThanThreshold($threshold)
{ {
@ -70,6 +72,9 @@ class ItemMapper extends \OCA\News\Db\ItemMapper
} }
} }
/**
* @return void
*/
public function readItem($itemId, $isRead, $lastModified, $userId) public function readItem($itemId, $isRead, $lastModified, $userId)
{ {
$item = $this->find($itemId, $userId); $item = $this->find($itemId, $userId);

View File

@ -62,6 +62,9 @@ class MigrateConfig implements IRepairStep
return 'Migrate config to nextcloud managed config'; return 'Migrate config to nextcloud managed config';
} }
/**
* @return void
*/
public function run(IOutput $output) public function run(IOutput $output)
{ {
$version = $this->iConfig->getAppValue('news', 'installed_version', '0.0.0'); $version = $this->iConfig->getAppValue('news', 'installed_version', '0.0.0');

View File

@ -45,6 +45,9 @@ class MigrateStatusFlags implements IRepairStep
return 'Migrate binary status into separate boolean fields'; return 'Migrate binary status into separate boolean fields';
} }
/**
* @return void
*/
public function run(IOutput $output) public function run(IOutput $output)
{ {
$version = $this->config->getAppValue('news', 'installed_version', '0.0.0'); $version = $this->config->getAppValue('news', 'installed_version', '0.0.0');

View File

@ -18,6 +18,8 @@ class Version140200Date20200824201413 extends SimpleMigrationStep {
* @param IOutput $output * @param IOutput $output
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
* @param array $options * @param array $options
*
* @return void
*/ */
public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options) { public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options) {
} }
@ -283,6 +285,8 @@ class Version140200Date20200824201413 extends SimpleMigrationStep {
* @param IOutput $output * @param IOutput $output
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
* @param array $options * @param array $options
*
* @return void
*/ */
public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options) { public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options) {
} }

View File

@ -26,6 +26,8 @@ class Version150004Date20201009183830 extends SimpleMigrationStep {
* @param IOutput $output * @param IOutput $output
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
* @param array $options * @param array $options
*
* @return void
*/ */
public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options) { public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options) {
} }
@ -63,6 +65,8 @@ class Version150004Date20201009183830 extends SimpleMigrationStep {
* @param IOutput $output * @param IOutput $output
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
* @param array $options * @param array $options
*
* @return void
*/ */
public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options) { public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options) {
$item_name = $this->connection->getQueryBuilder()->getTableName('news_items'); $item_name = $this->connection->getQueryBuilder()->getTableName('news_items');

View File

@ -27,6 +27,8 @@ class Version150005Date20201009192341 extends SimpleMigrationStep {
* @param IOutput $output * @param IOutput $output
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
* @param array $options * @param array $options
*
* @return void
*/ */
public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options) { public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options) {
$qb = $this->connection->getQueryBuilder(); $qb = $this->connection->getQueryBuilder();
@ -92,6 +94,8 @@ class Version150005Date20201009192341 extends SimpleMigrationStep {
* @param IOutput $output * @param IOutput $output
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
* @param array $options * @param array $options
*
* @return void
*/ */
public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options) { public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options) {
} }

View File

@ -26,12 +26,12 @@ class Plugin
private static $scripts = []; private static $scripts = [];
private static $styles = []; private static $styles = [];
public static function registerStyle($appName, $styleName) public static function registerStyle($appName, $styleName): void
{ {
self::$styles[$appName] = $styleName; self::$styles[$appName] = $styleName;
} }
public static function registerScript($appName, $scriptName) public static function registerScript($appName, $scriptName): void
{ {
self::$scripts[$appName] = $scriptName; self::$scripts[$appName] = $scriptName;
} }

View File

@ -116,8 +116,10 @@ class FolderServiceV2 extends Service
* *
* @param string|null $userID The user to purge * @param string|null $userID The user to purge
* @param int|null $minTimestamp The timestamp to purge from * @param int|null $minTimestamp The timestamp to purge from
*
* @return void
*/ */
public function purgeDeleted(?string $userID, ?int $minTimestamp) public function purgeDeleted(?string $userID, ?int $minTimestamp): void
{ {
$this->mapper->purgeDeleted($userID, $minTimestamp); $this->mapper->purgeDeleted($userID, $minTimestamp);
} }

View File

@ -71,9 +71,9 @@ class ImportService
* @param string $userId * @param string $userId
* @param array $json * @param array $json
* *
* @return array|null * @return \OCP\AppFramework\Db\Entity|null
*/ */
public function importArticles(string $userId, array $json) public function importArticles(string $userId, array $json): ?\OCP\AppFramework\Db\Entity
{ {
$url = 'http://nextcloud/nofeed'; $url = 'http://nextcloud/nofeed';

View File

@ -172,14 +172,17 @@ class ItemService extends Service
/** /**
* Star or unstar an item * Star or unstar an item
* *
* @param int $feedId the id of the item's feed that should be starred * @param int $feedId the id of the item's feed that should be starred
* @param string $guidHash the guidHash of the item that should be starred * @param string $guidHash the guidHash of the item that should be starred
* @param boolean $isStarred if true the item will be marked as starred, * @param boolean $isStarred if true the item will be marked as starred,
* if false unstar * if false unstar
* @param string $userId the name of the user for security reasons * @param string $userId the name of the user for security reasons
*
* @throws ServiceNotFoundException if the item does not exist * @throws ServiceNotFoundException if the item does not exist
*
* @return void
*/ */
public function star($feedId, $guidHash, $isStarred, $userId) public function star($feedId, $guidHash, $isStarred, $userId): void
{ {
try { try {
$item = $this->mapper->findByGuidHash($feedId, $guidHash); $item = $this->mapper->findByGuidHash($feedId, $guidHash);
@ -196,13 +199,16 @@ class ItemService extends Service
/** /**
* Read or unread an item * Read or unread an item
* *
* @param int $itemId the id of the item that should be read * @param int $itemId the id of the item that should be read
* @param boolean $isRead if true the item will be marked as read, * @param boolean $isRead if true the item will be marked as read,
* if false unread * if false unread
* @param string $userId the name of the user for security reasons * @param string $userId the name of the user for security reasons
*
* @throws ServiceNotFoundException if the item does not exist * @throws ServiceNotFoundException if the item does not exist
*
* @return void
*/ */
public function read($itemId, $isRead, $userId) public function read($itemId, $isRead, $userId): void
{ {
try { try {
$lastModified = $this->timeFactory->getMicroTime(); $lastModified = $this->timeFactory->getMicroTime();
@ -220,8 +226,10 @@ class ItemService extends Service
* used to prevent marking items as read that * used to prevent marking items as read that
* the users hasn't seen yet * the users hasn't seen yet
* @param string $userId the name of the user * @param string $userId the name of the user
*
* @return void
*/ */
public function readAll($highestItemId, $userId) public function readAll($highestItemId, $userId): void
{ {
$time = $this->timeFactory->getMicroTime(); $time = $this->timeFactory->getMicroTime();
$this->oldItemMapper->readAll($highestItemId, $time, $userId); $this->oldItemMapper->readAll($highestItemId, $time, $userId);
@ -236,8 +244,10 @@ class ItemService extends Service
* used to prevent marking items as read that * used to prevent marking items as read that
* the users hasn't seen yet * the users hasn't seen yet
* @param string $userId the name of the user * @param string $userId the name of the user
*
* @return void
*/ */
public function readFolder(?int $folderId, $highestItemId, $userId) public function readFolder(?int $folderId, $highestItemId, $userId): void
{ {
$time = $this->timeFactory->getMicroTime(); $time = $this->timeFactory->getMicroTime();
$this->oldItemMapper->readFolder( $this->oldItemMapper->readFolder(
@ -257,8 +267,10 @@ class ItemService extends Service
* used to prevent marking items as read that * used to prevent marking items as read that
* the users hasn't seen yet * the users hasn't seen yet
* @param string $userId the name of the user * @param string $userId the name of the user
*
* @return void
*/ */
public function readFeed($feedId, $highestItemId, $userId) public function readFeed($feedId, $highestItemId, $userId): void
{ {
$time = $this->timeFactory->getMicroTime(); $time = $this->timeFactory->getMicroTime();
$this->oldItemMapper->readFeed($feedId, $highestItemId, $time, $userId); $this->oldItemMapper->readFeed($feedId, $highestItemId, $time, $userId);
@ -270,8 +282,10 @@ class ItemService extends Service
* count of $this->autoPurgeCount starting by the oldest. This is to clean * count of $this->autoPurgeCount starting by the oldest. This is to clean
* up the database so that old entries don't spam your db. As criteria for * up the database so that old entries don't spam your db. As criteria for
* old, the id is taken * old, the id is taken
*
* @return void
*/ */
public function autoPurgeOld() public function autoPurgeOld(): void
{ {
$count = $this->config->getAppValue( $count = $this->config->getAppValue(
Application::NAME, Application::NAME,
@ -325,8 +339,10 @@ class ItemService extends Service
/** /**
* Regenerates the search index for all items * Regenerates the search index for all items
*
* @return void
*/ */
public function generateSearchIndices() public function generateSearchIndices(): void
{ {
$this->oldItemMapper->updateSearchIndices(); $this->oldItemMapper->updateSearchIndices();
} }

View File

@ -43,20 +43,20 @@ class UpdaterService
} }
public function beforeUpdate() public function beforeUpdate(): void
{ {
$this->folderService->purgeDeleted(null, null); $this->folderService->purgeDeleted(null, null);
$this->feedService->purgeDeleted(null, null); $this->feedService->purgeDeleted(null, null);
} }
public function update() public function update(): void
{ {
$this->feedService->fetchAll(); $this->feedService->fetchAll();
} }
public function afterUpdate() public function afterUpdate(): void
{ {
$this->itemService->purgeOverThreshold(null); $this->itemService->purgeOverThreshold(null);
} }

View File

@ -17,6 +17,9 @@ class AdminSection implements IIconSection
$this->l = $l; $this->l = $l;
} }
/**
* @return string
*/
public function getID() public function getID()
{ {
return 'news'; return 'news';
@ -32,6 +35,9 @@ class AdminSection implements IIconSection
return 10; return 10;
} }
/**
* @return string
*/
public function getIcon() public function getIcon()
{ {
return $this->url->imagePath('news', 'app-dark.svg'); return $this->url->imagePath('news', 'app-dark.svg');