Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/polls.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/AppInfo/Application.php8
-rw-r--r--lib/Controller/PublicController.php2
-rw-r--r--lib/Cron/JanitorCron.php3
-rw-r--r--lib/Cron/NotificationCron.php1
-rw-r--r--lib/Cron/UserDeletedJob.php1
-rw-r--r--lib/Db/CommentMapper.php2
-rw-r--r--lib/Db/LogMapper.php2
-rw-r--r--lib/Db/Model.php4
-rw-r--r--lib/Db/OptionMapper.php2
-rw-r--r--lib/Db/PollMapper.php2
-rw-r--r--lib/Db/PreferencesMapper.php2
-rw-r--r--lib/Db/ShareMapper.php2
-rw-r--r--lib/Db/SubscriptionMapper.php2
-rw-r--r--lib/Db/VoteMapper.php2
-rw-r--r--lib/Db/WatchMapper.php2
-rw-r--r--lib/Migration/Version0010Date20191227063812.php2
-rw-r--r--psalm-baseline.xml54
-rw-r--r--psalm.xml3
18 files changed, 76 insertions, 20 deletions
diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php
index 1c2793ab..4921d002 100644
--- a/lib/AppInfo/Application.php
+++ b/lib/AppInfo/Application.php
@@ -35,6 +35,8 @@ use OCA\Polls\Notification\Notifier;
use OCA\Polls\Listener\UserDeletedListener;
class Application extends App implements IBootstrap {
+
+ /** @var string */
public const APP_ID = 'polls';
public function __construct(array $urlParams = []) {
@@ -43,18 +45,14 @@ class Application extends App implements IBootstrap {
public function boot(IBootContext $context): void {
$context->injectFn(Closure::fromCallable([$this, 'registerNotifications']));
- $context->injectFn(Closure::fromCallable([$this, 'registerUserDeletedListener']));
}
public function register(IRegistrationContext $context): void {
+ $context->registerEventListener(UserDeletedEvent::class, UserDeletedListener::class);
}
public function registerNotifications(NotificationManager $notificationManager): void {
$notificationManager->registerNotifierService(Notifier::class);
}
- public function registerUserDeletedListener(): void {
- $eventDispatcher = $this->getContainer()->query(IEventDispatcher::class);
- $eventDispatcher->addServiceListener(UserDeletedEvent::class, UserDeletedListener::class);
- }
}
diff --git a/lib/Controller/PublicController.php b/lib/Controller/PublicController.php
index 0f034153..52706bc2 100644
--- a/lib/Controller/PublicController.php
+++ b/lib/Controller/PublicController.php
@@ -227,7 +227,7 @@ class PublicController extends Controller {
* @NoAdminRequired
* @PublicPage
*/
- public function addOption(string $token, $timestamp = 0, $pollOptionText = '', $duration = 0): DataResponse {
+ public function addOption(string $token, int $timestamp = 0, string $pollOptionText = '', int $duration = 0): DataResponse {
return $this->responseCreate(function () use ($token, $timestamp, $pollOptionText, $duration) {
return ['option' => $this->optionService->add(0, $timestamp, $pollOptionText, $duration, $token)];
});
diff --git a/lib/Cron/JanitorCron.php b/lib/Cron/JanitorCron.php
index 24392440..c1b6a142 100644
--- a/lib/Cron/JanitorCron.php
+++ b/lib/Cron/JanitorCron.php
@@ -42,12 +42,13 @@ class JanitorCron extends TimedJob {
WatchMapper $watchMapper
) {
parent::__construct($time);
+ parent::setInterval(86400); // run once a day
$this->logMapper = $logMapper;
$this->watchMapper = $watchMapper;
- parent::setInterval(86400); // run once a day
}
/**
+ * @param mixed $arguments
* @return void
*/
protected function run($arguments) {
diff --git a/lib/Cron/NotificationCron.php b/lib/Cron/NotificationCron.php
index 87f127f1..148f7f34 100644
--- a/lib/Cron/NotificationCron.php
+++ b/lib/Cron/NotificationCron.php
@@ -42,6 +42,7 @@ class NotificationCron extends TimedJob {
}
/**
+ * @param mixed $arguments
* @return void
*/
protected function run($arguments) {
diff --git a/lib/Cron/UserDeletedJob.php b/lib/Cron/UserDeletedJob.php
index 7c02f854..e1e7d53f 100644
--- a/lib/Cron/UserDeletedJob.php
+++ b/lib/Cron/UserDeletedJob.php
@@ -90,6 +90,7 @@ class UserDeletedJob extends QueuedJob {
}
/**
+ * @param mixed $arguments
* @return void
*/
protected function run($arguments) {
diff --git a/lib/Db/CommentMapper.php b/lib/Db/CommentMapper.php
index fc44d57a..8fbe4092 100644
--- a/lib/Db/CommentMapper.php
+++ b/lib/Db/CommentMapper.php
@@ -33,7 +33,7 @@ use OCP\AppFramework\Db\QBMapper;
*/
class CommentMapper extends QBMapper {
public function __construct(IDBConnection $db) {
- parent::__construct($db, 'polls_comments', 'OCA\Polls\Db\Comment');
+ parent::__construct($db, 'polls_comments', Comment::class);
}
/**
diff --git a/lib/Db/LogMapper.php b/lib/Db/LogMapper.php
index e2adcfc7..fc3b8849 100644
--- a/lib/Db/LogMapper.php
+++ b/lib/Db/LogMapper.php
@@ -34,7 +34,7 @@ use Doctrine\DBAL\Exception\TableNotFoundException;
*/
class LogMapper extends QBMapper {
public function __construct(IDBConnection $db) {
- parent::__construct($db, 'polls_log', 'OCA\Polls\Db\Log');
+ parent::__construct($db, 'polls_log', Log::class);
}
/**
diff --git a/lib/Db/Model.php b/lib/Db/Model.php
index 087f4842..0f91caa2 100644
--- a/lib/Db/Model.php
+++ b/lib/Db/Model.php
@@ -30,8 +30,8 @@ abstract class Model extends Entity {
* FactoryMuffin checks for the existence of setters with method_exists($obj, $attr) but that returns false.
* By overwriting the __set() magic method we can trigger the changed flag on $obj->attr assignment.
*
- * @param $name
- * @param $value
+ * @param string $name
+ * @param mixed $value
*/
public function __set($name, $value) {
$this->setter($name, [$value]);
diff --git a/lib/Db/OptionMapper.php b/lib/Db/OptionMapper.php
index d1badaa3..98135c8d 100644
--- a/lib/Db/OptionMapper.php
+++ b/lib/Db/OptionMapper.php
@@ -34,7 +34,7 @@ use Doctrine\DBAL\Exception\TableNotFoundException;
*/
class OptionMapper extends QBMapper {
public function __construct(IDBConnection $db) {
- parent::__construct($db, 'polls_options', 'OCA\Polls\Db\Option');
+ parent::__construct($db, 'polls_options', Option::class);
}
/**
diff --git a/lib/Db/PollMapper.php b/lib/Db/PollMapper.php
index 4fd83d1a..60c7f473 100644
--- a/lib/Db/PollMapper.php
+++ b/lib/Db/PollMapper.php
@@ -33,7 +33,7 @@ use OCP\AppFramework\Db\QBMapper;
*/
class PollMapper extends QBMapper {
public function __construct(IDBConnection $db) {
- parent::__construct($db, 'polls_polls', 'OCA\Polls\Db\Poll');
+ parent::__construct($db, 'polls_polls', Poll::class);
}
/**
diff --git a/lib/Db/PreferencesMapper.php b/lib/Db/PreferencesMapper.php
index 4d9554e5..25c908d9 100644
--- a/lib/Db/PreferencesMapper.php
+++ b/lib/Db/PreferencesMapper.php
@@ -33,7 +33,7 @@ use Doctrine\DBAL\Exception\TableNotFoundException;
*/
class PreferencesMapper extends QBMapper {
public function __construct(IDBConnection $db) {
- parent::__construct($db, 'polls_preferences', 'OCA\Polls\Db\Preferences');
+ parent::__construct($db, 'polls_preferences', Preferences::class);
}
/**
diff --git a/lib/Db/ShareMapper.php b/lib/Db/ShareMapper.php
index 0997e9c0..15643213 100644
--- a/lib/Db/ShareMapper.php
+++ b/lib/Db/ShareMapper.php
@@ -34,7 +34,7 @@ use Doctrine\DBAL\Exception\TableNotFoundException;
*/
class ShareMapper extends QBMapper {
public function __construct(IDBConnection $db) {
- parent::__construct($db, 'polls_share', 'OCA\Polls\Db\Share');
+ parent::__construct($db, 'polls_share', Share::class);
}
/**
diff --git a/lib/Db/SubscriptionMapper.php b/lib/Db/SubscriptionMapper.php
index aead17cb..7b7a7e09 100644
--- a/lib/Db/SubscriptionMapper.php
+++ b/lib/Db/SubscriptionMapper.php
@@ -34,7 +34,7 @@ use Doctrine\DBAL\Exception\TableNotFoundException;
*/
class SubscriptionMapper extends QBMapper {
public function __construct(IDBConnection $db) {
- parent::__construct($db, 'polls_notif', 'OCA\Polls\Db\Subscription');
+ parent::__construct($db, 'polls_notif', Subscription::class);
}
/**
diff --git a/lib/Db/VoteMapper.php b/lib/Db/VoteMapper.php
index 78419ae0..ef4b63f3 100644
--- a/lib/Db/VoteMapper.php
+++ b/lib/Db/VoteMapper.php
@@ -34,7 +34,7 @@ use Doctrine\DBAL\Exception\TableNotFoundException;
*/
class VoteMapper extends QBMapper {
public function __construct(IDBConnection $db) {
- parent::__construct($db, 'polls_votes', 'OCA\Polls\Db\Vote');
+ parent::__construct($db, 'polls_votes', Vote::class);
}
/**
diff --git a/lib/Db/WatchMapper.php b/lib/Db/WatchMapper.php
index e250ff0e..4d6eca7d 100644
--- a/lib/Db/WatchMapper.php
+++ b/lib/Db/WatchMapper.php
@@ -31,7 +31,7 @@ use OCP\AppFramework\Db\QBMapper;
*/
class WatchMapper extends QBMapper {
public function __construct(IDBConnection $db) {
- parent::__construct($db, 'polls_watch', 'OCA\Polls\Db\Watch');
+ parent::__construct($db, 'polls_watch', Watch::class);
}
/**
diff --git a/lib/Migration/Version0010Date20191227063812.php b/lib/Migration/Version0010Date20191227063812.php
index 7112770b..2e882c9c 100644
--- a/lib/Migration/Version0010Date20191227063812.php
+++ b/lib/Migration/Version0010Date20191227063812.php
@@ -254,7 +254,7 @@ class Version0010Date20191227063812 extends SimpleMigrationStep {
return json_encode(['yes', 'no']);
}
- private function resolveType($type): string {
+ private function resolveType(string $type): string {
if ($type) {
return 'textPoll';
}
diff --git a/psalm-baseline.xml b/psalm-baseline.xml
new file mode 100644
index 00000000..381f08a0
--- /dev/null
+++ b/psalm-baseline.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<files psalm-version="4.7.2@83a0325c0a95c0ab531d6b90c877068b464377b5">
+ <file src="lib/Db/LogMapper.php">
+ <PossiblyInvalidMethodCall occurrences="1">
+ <code>fetch</code>
+ </PossiblyInvalidMethodCall>
+ </file>
+ <file src="lib/Db/OptionMapper.php">
+ <PossiblyInvalidMethodCall occurrences="1">
+ <code>fetch</code>
+ </PossiblyInvalidMethodCall>
+ </file>
+ <file src="lib/Db/PreferencesMapper.php">
+ <PossiblyInvalidMethodCall occurrences="1">
+ <code>fetch</code>
+ </PossiblyInvalidMethodCall>
+ </file>
+ <file src="lib/Db/ShareMapper.php">
+ <PossiblyInvalidMethodCall occurrences="1">
+ <code>fetch</code>
+ </PossiblyInvalidMethodCall>
+ </file>
+ <file src="lib/Db/SubscriptionMapper.php">
+ <PossiblyInvalidMethodCall occurrences="1">
+ <code>fetch</code>
+ </PossiblyInvalidMethodCall>
+ </file>
+ <file src="lib/Db/VoteMapper.php">
+ <PossiblyInvalidMethodCall occurrences="1">
+ <code>fetch</code>
+ </PossiblyInvalidMethodCall>
+ </file>
+ <file src="lib/Migration/Version0009Date20181125061900.php">
+ <PossiblyInvalidMethodCall occurrences="9">
+ <code>closeCursor</code>
+ <code>closeCursor</code>
+ <code>closeCursor</code>
+ <code>closeCursor</code>
+ <code>fetch</code>
+ <code>fetch</code>
+ <code>fetch</code>
+ <code>fetch</code>
+ <code>fetch</code>
+ </PossiblyInvalidMethodCall>
+ </file>
+ <file src="lib/Migration/Version0010Date20191227063812.php">
+ <PossiblyInvalidMethodCall occurrences="4">
+ <code>closeCursor</code>
+ <code>closeCursor</code>
+ <code>fetch</code>
+ <code>fetch</code>
+ </PossiblyInvalidMethodCall>
+ </file>
+</files>
diff --git a/psalm.xml b/psalm.xml
index b15701e3..05bf93ed 100644
--- a/psalm.xml
+++ b/psalm.xml
@@ -5,6 +5,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config"
+ errorBaseline="psalm-baseline.xml"
>
<projectFiles>
<directory name="lib" />
@@ -20,8 +21,8 @@
<errorLevel type="suppress">
<referencedClass name="OC" />
<referencedClass name="OC\Core\Command\Base" />
- <referencedClass name="OC\DB\SchemaWrapper" />
<referencedClass name="OC\DB\Connection" />
+ <referencedClass name="OC\DB\SchemaWrapper" />
<referencedClass name="OCA\Circles\Api\v1\Circles" />
</errorLevel>
</UndefinedClass>