Skip to content

Commit

Permalink
Fix most psalm issues
Browse files Browse the repository at this point in the history
  • Loading branch information
st3iny committed Oct 17, 2024
1 parent 5305b56 commit 0a2b6a8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
4 changes: 1 addition & 3 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
use OCA\Mail\Events\MessageDeletedEvent;
use OCA\Mail\Events\MessageFlaggedEvent;
use OCA\Mail\Events\MessageSentEvent;
use OCA\Mail\Events\NewMessagesSynchronized;
use OCA\Mail\Events\OutboxMessageCreatedEvent;
use OCA\Mail\Events\SynchronizationEvent;
use OCA\Mail\HordeTranslationHandler;
Expand All @@ -44,7 +45,6 @@
use OCA\Mail\Listener\MessageCacheUpdaterListener;
use OCA\Mail\Listener\MessageKnownSinceListener;
use OCA\Mail\Listener\MoveJunkListener;
use OCA\Mail\Listener\NewMessageClassificationListener;
use OCA\Mail\Listener\NewMessagesNotifier;
use OCA\Mail\Listener\OauthTokenRefreshListener;
use OCA\Mail\Listener\OptionalIndicesListener;
Expand Down Expand Up @@ -123,10 +123,8 @@ public function register(IRegistrationContext $context): void {
$context->registerEventListener(MessageDeletedEvent::class, MessageCacheUpdaterListener::class);
$context->registerEventListener(MessageSentEvent::class, AddressCollectionListener::class);
$context->registerEventListener(MessageSentEvent::class, InteractionListener::class);
$context->registerEventListener(NewMessagesSynchronized::class, NewMessageClassificationListener::class);
$context->registerEventListener(NewMessagesSynchronized::class, MessageKnownSinceListener::class);
$context->registerEventListener(NewMessagesSynchronized::class, NewMessagesNotifier::class);
$context->registerEventListener(MessageSentEvent::class, SaveSentMessageListener::class);
$context->registerEventListener(SynchronizationEvent::class, AccountSynchronizedThreadUpdaterListener::class);
$context->registerEventListener(UserDeletedEvent::class, UserDeletedListener::class);
$context->registerEventListener(NewMessagesSynchronized::class, FollowUpClassifierListener::class);
Expand Down
4 changes: 2 additions & 2 deletions lib/Db/StatisticsDao.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public function getSubjects(array $mailboxes, array $emails): array {
->where($qb->expr()->eq('r.type', $qb->createNamedParameter(Address::TYPE_FROM, IQueryBuilder::PARAM_INT), IQueryBuilder::PARAM_INT))
->andWhere($qb->expr()->in('m.mailbox_id', $qb->createNamedParameter($mailboxIds, IQueryBuilder::PARAM_INT_ARRAY)))
->andWhere($qb->expr()->in('r.email', $qb->createNamedParameter($emails, IQueryBuilder::PARAM_STR_ARRAY), IQueryBuilder::PARAM_STR_ARRAY));
$result = $select->execute();
$result = $select->executeQuery();
$rows = $result->fetchAll();
$result->closeCursor();
$data = [];
Expand All @@ -181,7 +181,7 @@ public function getPreviewTexts(array $mailboxes, array $emails): array {
->andWhere($qb->expr()->in('m.mailbox_id', $qb->createNamedParameter($mailboxIds, IQueryBuilder::PARAM_INT_ARRAY)))
->andWhere($qb->expr()->in('r.email', $qb->createNamedParameter($emails, IQueryBuilder::PARAM_STR_ARRAY), IQueryBuilder::PARAM_STR_ARRAY))
->andWhere($qb->expr()->isNotNull('m.preview_text'));
$result = $select->execute();
$result = $select->executeQuery();
$rows = $result->fetchAll();
$result->closeCursor();
$data = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,13 @@ public function extract(Message $message): array {
* Limit feature vector length to actual vocabulary size.
*/
private function limitFeatureSize(): void {
$vocab = $this->wordCountVectorizer->vocabularies()[0];
$this->max = count($vocab);
$vocabularies = $this->wordCountVectorizer->vocabularies();
if (!isset($vocabularies[0])) {
// Should not happen but better safe than sorry
return;
}

$this->max = count($vocabularies[0]);
echo("WCF vocab size: {$this->max}\n");
}
}
5 changes: 1 addition & 4 deletions lib/Service/Sync/ImapToDbSynchronizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use OCA\Mail\Db\MessageMapper as DatabaseMessageMapper;
use OCA\Mail\Db\Tag;
use OCA\Mail\Db\TagMapper;
use OCA\Mail\Events\NewMessagesSynchronized;
use OCA\Mail\Events\SynchronizationEvent;
use OCA\Mail\Exception\ClientException;
use OCA\Mail\Exception\IncompleteSyncException;
Expand All @@ -30,7 +31,6 @@
use OCA\Mail\Exception\UidValidityChangedException;
use OCA\Mail\IMAP\IMAPClientFactory;
use OCA\Mail\IMAP\MessageMapper as ImapMessageMapper;
use OCA\Mail\IMAP\PreviewEnhancer;
use OCA\Mail\IMAP\Sync\Request;
use OCA\Mail\IMAP\Sync\Synchronizer;
use OCA\Mail\Model\IMAPMessage;
Expand Down Expand Up @@ -76,7 +76,6 @@ class ImapToDbSynchronizer {
/** @var IMailManager */
private $mailManager;

private PreviewEnhancer $previewEnhancer;
private TagMapper $tagMapper;
private NewMessagesClassifier $newMessagesClassifier;

Expand All @@ -90,7 +89,6 @@ public function __construct(DatabaseMessageMapper $dbMapper,
PerformanceLogger $performanceLogger,
LoggerInterface $logger,
IMailManager $mailManager,
PreviewEnhancer $previewEnhancer,
TagMapper $tagMapper,
NewMessagesClassifier $newMessagesClassifier) {
$this->dbMapper = $dbMapper;
Expand All @@ -102,7 +100,6 @@ public function __construct(DatabaseMessageMapper $dbMapper,
$this->performanceLogger = $performanceLogger;
$this->logger = $logger;
$this->mailManager = $mailManager;
$this->previewEnhancer = $previewEnhancer;
$this->tagMapper = $tagMapper;
$this->newMessagesClassifier = $newMessagesClassifier;
}
Expand Down

0 comments on commit 0a2b6a8

Please sign in to comment.