summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Molenaar <sean@seanmolenaar.eu>2021-01-08 23:26:10 +0100
committerSean Molenaar <SMillerDev@users.noreply.github.com>2021-01-12 13:29:08 +0100
commit67b6c4e1b0a9fa0138eb897f8a19e5b85d705c29 (patch)
treee1eeaea2f2e9bd41a9ca9437109f0fe2f3306295
parente5d56f2c2e4542fca98194620a30605aa9e14437 (diff)
Fix psalm issues
Signed-off-by: Sean Molenaar <sean@seanmolenaar.eu>
-rw-r--r--lib/Command/Config/FeedAdd.php2
-rw-r--r--lib/Command/Config/FeedDelete.php7
-rw-r--r--lib/Command/Config/FeedList.php2
-rw-r--r--lib/Command/Config/FolderAdd.php4
-rw-r--r--lib/Command/Config/FolderDelete.php5
-rw-r--r--lib/Command/Config/FolderList.php3
-rw-r--r--lib/Command/Config/OpmlExport.php4
-rw-r--r--lib/Command/ExploreGenerator.php3
-rw-r--r--lib/Command/ShowFeed.php2
-rw-r--r--lib/Command/Updater/AfterUpdate.php5
-rw-r--r--lib/Command/Updater/AllFeeds.php3
-rw-r--r--lib/Command/Updater/BeforeUpdate.php3
-rw-r--r--lib/Command/Updater/UpdateFeed.php5
-rw-r--r--lib/Config/FetcherConfig.php1
-rw-r--r--lib/Config/LegacyConfig.php3
-rw-r--r--lib/Controller/FeedApiController.php1
-rw-r--r--lib/Controller/UserApiController.php3
-rw-r--r--lib/Cron/UpdaterJob.php3
-rw-r--r--lib/Db/FeedMapperV2.php2
-rw-r--r--lib/Db/ItemMapper.php1
-rw-r--r--lib/Db/ItemMapperV2.php3
-rw-r--r--lib/Db/NewsMapperV2.php1
-rw-r--r--lib/Fetcher/IFeedFetcher.php2
-rw-r--r--lib/Service/FeedServiceV2.php7
-rw-r--r--lib/Service/FolderServiceV2.php4
-rw-r--r--lib/Service/ItemService.php2
-rw-r--r--lib/Service/OpmlService.php4
-rw-r--r--lib/Service/Service.php1
-rw-r--r--lib/Service/UpdaterService.php2
-rw-r--r--psalm.xml1
30 files changed, 45 insertions, 44 deletions
diff --git a/lib/Command/Config/FeedAdd.php b/lib/Command/Config/FeedAdd.php
index 86121ad06..4b4279267 100644
--- a/lib/Command/Config/FeedAdd.php
+++ b/lib/Command/Config/FeedAdd.php
@@ -32,6 +32,8 @@ class FeedAdd extends Command
/**
* Configure command
+ *
+ * @return void
*/
protected function configure()
{
diff --git a/lib/Command/Config/FeedDelete.php b/lib/Command/Config/FeedDelete.php
index fae1abdb2..6773a6525 100644
--- a/lib/Command/Config/FeedDelete.php
+++ b/lib/Command/Config/FeedDelete.php
@@ -2,13 +2,10 @@
namespace OCA\News\Command\Config;
-use OCA\News\Db\Feed;
use OCA\News\Service\FeedServiceV2;
-use OCA\News\Service\FolderServiceV2;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
-use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class FeedDelete extends Command
@@ -27,6 +24,8 @@ class FeedDelete extends Command
/**
* Configure command
+ *
+ * @return void
*/
protected function configure()
{
@@ -47,7 +46,7 @@ class FeedDelete extends Command
protected function execute(InputInterface $input, OutputInterface $output): int
{
$user = $input->getArgument('user-id');
- $id = $input->getArgument('feed-id');
+ $id = (int) $input->getArgument('feed-id');
$this->feedService->delete($user, $id);
diff --git a/lib/Command/Config/FeedList.php b/lib/Command/Config/FeedList.php
index 3462ff5c8..41beb1bfc 100644
--- a/lib/Command/Config/FeedList.php
+++ b/lib/Command/Config/FeedList.php
@@ -28,6 +28,8 @@ class FeedList extends Command
/**
* Configure command
+ *
+ * @return void
*/
protected function configure()
{
diff --git a/lib/Command/Config/FolderAdd.php b/lib/Command/Config/FolderAdd.php
index 03ad72535..503d63a31 100644
--- a/lib/Command/Config/FolderAdd.php
+++ b/lib/Command/Config/FolderAdd.php
@@ -2,8 +2,6 @@
namespace OCA\News\Command\Config;
-use OCA\News\Db\Feed;
-use OCA\News\Service\FeedServiceV2;
use OCA\News\Service\FolderServiceV2;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
@@ -27,6 +25,8 @@ class FolderAdd extends Command
/**
* Configure command
+ *
+ * @return void
*/
protected function configure()
{
diff --git a/lib/Command/Config/FolderDelete.php b/lib/Command/Config/FolderDelete.php
index 397eda999..a80875682 100644
--- a/lib/Command/Config/FolderDelete.php
+++ b/lib/Command/Config/FolderDelete.php
@@ -2,14 +2,11 @@
namespace OCA\News\Command\Config;
-use OCA\News\Db\Feed;
use OCA\News\Service\Exceptions\ServiceException;
-use OCA\News\Service\FeedServiceV2;
use OCA\News\Service\FolderServiceV2;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
-use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class FolderDelete extends Command
@@ -28,6 +25,8 @@ class FolderDelete extends Command
/**
* Configure command
+ *
+ * @return void
*/
protected function configure()
{
diff --git a/lib/Command/Config/FolderList.php b/lib/Command/Config/FolderList.php
index 6340f4d57..158747be5 100644
--- a/lib/Command/Config/FolderList.php
+++ b/lib/Command/Config/FolderList.php
@@ -3,7 +3,6 @@
namespace OCA\News\Command\Config;
use OCA\News\Controller\ApiPayloadTrait;
-use OCA\News\Service\FeedServiceV2;
use OCA\News\Service\FolderServiceV2;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
@@ -29,6 +28,8 @@ class FolderList extends Command
/**
* Configure command
+ *
+ * @return void
*/
protected function configure()
{
diff --git a/lib/Command/Config/OpmlExport.php b/lib/Command/Config/OpmlExport.php
index f51aed555..eec93ddbf 100644
--- a/lib/Command/Config/OpmlExport.php
+++ b/lib/Command/Config/OpmlExport.php
@@ -24,6 +24,8 @@ class OpmlExport extends Command
/**
* Configure command
+ *
+ * @return void
*/
protected function configure()
{
@@ -38,7 +40,7 @@ class OpmlExport extends Command
* @param InputInterface $input
* @param OutputInterface $output
*
- * @return int|void
+ * @return int
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
diff --git a/lib/Command/ExploreGenerator.php b/lib/Command/ExploreGenerator.php
index 65c206c5e..01ef2a866 100644
--- a/lib/Command/ExploreGenerator.php
+++ b/lib/Command/ExploreGenerator.php
@@ -44,6 +44,9 @@ class ExploreGenerator extends Command
parent::__construct();
}
+ /**
+ * @return void
+ */
protected function configure()
{
$result = [
diff --git a/lib/Command/ShowFeed.php b/lib/Command/ShowFeed.php
index 0016470e6..4e3084322 100644
--- a/lib/Command/ShowFeed.php
+++ b/lib/Command/ShowFeed.php
@@ -41,6 +41,8 @@ class ShowFeed extends Command
/**
* Configure the command
+ *
+ * @return void
*/
protected function configure()
{
diff --git a/lib/Command/Updater/AfterUpdate.php b/lib/Command/Updater/AfterUpdate.php
index 62ceb2710..bedc8c9ff 100644
--- a/lib/Command/Updater/AfterUpdate.php
+++ b/lib/Command/Updater/AfterUpdate.php
@@ -35,6 +35,9 @@ class AfterUpdate extends Command
$this->itemService = $itemService;
}
+ /**
+ * @return void
+ */
protected function configure()
{
$this->setName('news:updater:after-update')
@@ -44,7 +47,7 @@ class AfterUpdate extends Command
protected function execute(InputInterface $input, OutputInterface $output): int
{
- $count = $input->getArgument('purge_count');
+ $count = (int) $input->getArgument('purge_count');
$output->writeln($this->itemService->purgeOverThreshold($count));
diff --git a/lib/Command/Updater/AllFeeds.php b/lib/Command/Updater/AllFeeds.php
index 942b5706d..384508d7d 100644
--- a/lib/Command/Updater/AllFeeds.php
+++ b/lib/Command/Updater/AllFeeds.php
@@ -40,6 +40,9 @@ class AllFeeds extends Command
$this->feedService = $feedService;
}
+ /**
+ * @return void
+ */
protected function configure()
{
$json = '{"feeds": [{"id": 39, "userId": "john"}, // etc ]}';
diff --git a/lib/Command/Updater/BeforeUpdate.php b/lib/Command/Updater/BeforeUpdate.php
index 787125c32..605a2c9ee 100644
--- a/lib/Command/Updater/BeforeUpdate.php
+++ b/lib/Command/Updater/BeforeUpdate.php
@@ -29,6 +29,9 @@ class BeforeUpdate extends Command
$this->updaterService = $updater;
}
+ /**
+ * @return void
+ */
protected function configure()
{
$this->setName('news:updater:before-update')
diff --git a/lib/Command/Updater/UpdateFeed.php b/lib/Command/Updater/UpdateFeed.php
index 4ffb8f57a..401ae7199 100644
--- a/lib/Command/Updater/UpdateFeed.php
+++ b/lib/Command/Updater/UpdateFeed.php
@@ -30,6 +30,9 @@ class UpdateFeed extends Command
$this->feedService = $feedService;
}
+ /**
+ * @return void
+ */
protected function configure()
{
$this->setName('news:updater:update-feed')
@@ -48,8 +51,8 @@ class UpdateFeed extends Command
protected function execute(InputInterface $input, OutputInterface $output): int
{
- $feedId = $input->getArgument('feed-id');
$userId = $input->getArgument('user-id');
+ $feedId = (int) $input->getArgument('feed-id');
try {
$feed = $this->feedService->find($userId, $feedId);
$updated_feed = $this->feedService->fetch($feed);
diff --git a/lib/Config/FetcherConfig.php b/lib/Config/FetcherConfig.php
index 3e75d854a..7c3e5f3d1 100644
--- a/lib/Config/FetcherConfig.php
+++ b/lib/Config/FetcherConfig.php
@@ -17,7 +17,6 @@ use FeedIo\Adapter\ClientInterface;
use \GuzzleHttp\Client;
use OCA\News\AppInfo\Application;
use OCA\News\Fetcher\Client\FeedIoClient;
-use OCA\News\Fetcher\Client\LegacyGuzzleClient;
use OCP\IConfig;
/**
diff --git a/lib/Config/LegacyConfig.php b/lib/Config/LegacyConfig.php
index f5cd36ffb..3267e132e 100644
--- a/lib/Config/LegacyConfig.php
+++ b/lib/Config/LegacyConfig.php
@@ -13,10 +13,7 @@
namespace OCA\News\Config;
-use OCA\News\AppInfo\Application;
-use OCA\News\Utility\PsrLogger;
use OCP\Files\Folder;
-use OCP\IConfig;
use Psr\Log\LoggerInterface;
class LegacyConfig
diff --git a/lib/Controller/FeedApiController.php b/lib/Controller/FeedApiController.php
index af552f411..629f2c482 100644
--- a/lib/Controller/FeedApiController.php
+++ b/lib/Controller/FeedApiController.php
@@ -16,7 +16,6 @@
namespace OCA\News\Controller;
use Exception;
-use OCA\News\AppInfo\Application;
use OCA\News\Service\Exceptions\ServiceConflictException;
use OCA\News\Service\Exceptions\ServiceNotFoundException;
use OCA\News\Service\FeedServiceV2;
diff --git a/lib/Controller/UserApiController.php b/lib/Controller/UserApiController.php
index 42f5607fe..f5721c837 100644
--- a/lib/Controller/UserApiController.php
+++ b/lib/Controller/UserApiController.php
@@ -17,9 +17,6 @@ namespace OCA\News\Controller;
use \OCP\IRequest;
use \OCP\IUserSession;
-use \OCP\IURLGenerator;
-use \OCP\Files\IRootFolder;
-use \OCP\AppFramework\Http;
class UserApiController extends ApiController
{
diff --git a/lib/Cron/UpdaterJob.php b/lib/Cron/UpdaterJob.php
index bec1c3579..d5ecce593 100644
--- a/lib/Cron/UpdaterJob.php
+++ b/lib/Cron/UpdaterJob.php
@@ -52,6 +52,9 @@ class UpdaterJob extends TimedJob
parent::setInterval($interval);
}
+ /**
+ * @return void
+ */
protected function run($argument)
{
$uses_cron = $this->config->getAppValue(
diff --git a/lib/Db/FeedMapperV2.php b/lib/Db/FeedMapperV2.php
index 3f25b26aa..b3d8879f3 100644
--- a/lib/Db/FeedMapperV2.php
+++ b/lib/Db/FeedMapperV2.php
@@ -74,7 +74,7 @@ class FeedMapperV2 extends NewsMapperV2
* @param string $userId The user identifier
* @param int $id The feed identifier
*
- * @return Entity
+ * @return Feed
*
* @throws DoesNotExistException
* @throws MultipleObjectsReturnedException
diff --git a/lib/Db/ItemMapper.php b/lib/Db/ItemMapper.php
index abd57b7c1..9b0c04d1d 100644
--- a/lib/Db/ItemMapper.php
+++ b/lib/Db/ItemMapper.php
@@ -13,7 +13,6 @@
namespace OCA\News\Db;
-use Exception;
use OCA\News\Utility\Time;
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Db\Entity;
diff --git a/lib/Db/ItemMapperV2.php b/lib/Db/ItemMapperV2.php
index a67275320..0c3191540 100644
--- a/lib/Db/ItemMapperV2.php
+++ b/lib/Db/ItemMapperV2.php
@@ -12,7 +12,6 @@
namespace OCA\News\Db;
-use Doctrine\DBAL\FetchMode;
use OCA\News\Utility\Time;
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Db\Entity;
@@ -152,7 +151,7 @@ class ItemMapperV2 extends NewsMapperV2
->groupBy('feed_id')
->where('');
- return $this->db->executeQuery($query)->fetch(FetchMode::ASSOCIATIVE);
+ return $this->db->executeQuery($query->getSQL());
}
/**
diff --git a/lib/Db/NewsMapperV2.php b/lib/Db/NewsMapperV2.php
index 4d0c6fc2e..f7179574c 100644
--- a/lib/Db/NewsMapperV2.php
+++ b/lib/Db/NewsMapperV2.php
@@ -18,7 +18,6 @@ use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Db\MultipleObjectsReturnedException;
use OCP\AppFramework\Db\QBMapper;
use OCP\IDBConnection;
-use OCP\AppFramework\Db\Mapper;
use OCP\AppFramework\Db\Entity;
/**
diff --git a/lib/Fetcher/IFeedFetcher.php b/lib/Fetcher/IFeedFetcher.php
index bfa737805..ff9a89903 100644
--- a/lib/Fetcher/IFeedFetcher.php
+++ b/lib/Fetcher/IFeedFetcher.php
@@ -31,7 +31,7 @@ interface IFeedFetcher
* @param string|null $user if given, basic auth is set for this feed
* @param string|null $password if given, basic auth is set for this feed. Ignored if user is empty
*
- * @return <Feed, Item[]> an array containing the new feed and its items, first
+ * @return array<Feed, Item[]> an array containing the new feed and its items, first
* element being the Feed and second element being an array of Items
*
* @throws ReadErrorException if the Feed-IO fetcher encounters a problem
diff --git a/lib/Service/FeedServiceV2.php b/lib/Service/FeedServiceV2.php
index 88f18a3bf..00511beb6 100644
--- a/lib/Service/FeedServiceV2.php
+++ b/lib/Service/FeedServiceV2.php
@@ -22,17 +22,10 @@ use OCA\News\Fetcher\FeedFetcher;
use OCA\News\Service\Exceptions\ServiceConflictException;
use OCA\News\Service\Exceptions\ServiceNotFoundException;
use OCP\AppFramework\Db\Entity;
-use OCP\AppFramework\Db\MultipleObjectsReturnedException;
-use OCP\ILogger;
-use OCP\IL10N;
use OCP\AppFramework\Db\DoesNotExistException;
use OCA\News\Db\Feed;
use OCA\News\Db\Item;
-use OCA\News\Db\ItemMapper;
-use OCA\News\Fetcher\Fetcher;
-use OCA\News\Config\Config;
-use OCA\News\Utility\Time;
use Psr\Log\LoggerInterface;
/**
diff --git a/lib/Service/FolderServiceV2.php b/lib/Service/FolderServiceV2.php
index c60d13172..ae8d37816 100644
--- a/lib/Service/FolderServiceV2.php
+++ b/lib/Service/FolderServiceV2.php
@@ -18,9 +18,7 @@ use OCA\News\Db\Folder;
use OCA\News\Db\FolderMapperV2;
use OCA\News\Service\Exceptions\ServiceConflictException;
use OCA\News\Service\Exceptions\ServiceNotFoundException;
-use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Db\Entity;
-use OCP\AppFramework\Db\MultipleObjectsReturnedException;
use Psr\Log\LoggerInterface;
/**
@@ -35,7 +33,7 @@ class FolderServiceV2 extends Service
*/
private $feedService;
/**
- * @var FeedServiceV2
+ * @var TimeFactory
*/
private $timeFactory;
diff --git a/lib/Service/ItemService.php b/lib/Service/ItemService.php
index 58533cb7d..62a319346 100644
--- a/lib/Service/ItemService.php
+++ b/lib/Service/ItemService.php
@@ -14,10 +14,8 @@
namespace OCA\News\Service;
use OCA\News\AppInfo\Application;
-use OCA\News\Db\Item;
use OCA\News\Db\ItemMapperV2;
use OCA\News\Service\Exceptions\ServiceNotFoundException;
-use OCP\AppFramework\Db\Entity;
use OCP\IConfig;
use OCP\AppFramework\Db\DoesNotExistException;
diff --git a/lib/Service/OpmlService.php b/lib/Service/OpmlService.php
index 932b5c9a5..f03e0448b 100644
--- a/