From 01c2ae23aac4cebad7b723071c765fccb71f3705 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Tue, 24 Jan 2023 11:46:47 +0100 Subject: [PATCH] chore(psalm): Add type hints to make psalm happy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- lib/Activity/DeckProvider.php | 2 +- lib/Activity/DescriptionSetting.php | 4 ++-- lib/Activity/Filter.php | 12 ++++++------ lib/Activity/Setting.php | 14 +++++++------- lib/Activity/SettingComment.php | 6 +++--- tests/psalm-baseline.xml | 5 +++++ 6 files changed, 24 insertions(+), 19 deletions(-) diff --git a/lib/Activity/DeckProvider.php b/lib/Activity/DeckProvider.php index d19bcc72b..5a79275cd 100644 --- a/lib/Activity/DeckProvider.php +++ b/lib/Activity/DeckProvider.php @@ -77,7 +77,7 @@ class DeckProvider implements IProvider { * @throws \InvalidArgumentException Should be thrown if your provider does not know this event * @since 11.0.0 */ - public function parse($language, IEvent $event, IEvent $previousEvent = null) { + public function parse($language, IEvent $event, IEvent $previousEvent = null): IEvent { if ($event->getApp() !== 'deck') { throw new \InvalidArgumentException(); } diff --git a/lib/Activity/DescriptionSetting.php b/lib/Activity/DescriptionSetting.php index 5ba28f8f2..922cb2b02 100644 --- a/lib/Activity/DescriptionSetting.php +++ b/lib/Activity/DescriptionSetting.php @@ -29,7 +29,7 @@ class DescriptionSetting extends Setting { * @return string Lowercase a-z and underscore only identifier * @since 11.0.0 */ - public function getIdentifier() { + public function getIdentifier(): string { return 'deck_card_description'; } @@ -37,7 +37,7 @@ class DescriptionSetting extends Setting { * @return string A translated string * @since 11.0.0 */ - public function getName() { + public function getName(): string { return $this->l->t('A card description inside the Deck app has been changed'); } } diff --git a/lib/Activity/Filter.php b/lib/Activity/Filter.php index 7f849d66e..f4beeb100 100644 --- a/lib/Activity/Filter.php +++ b/lib/Activity/Filter.php @@ -42,7 +42,7 @@ class Filter implements \OCP\Activity\IFilter { * @return string Lowercase a-z and underscore only identifier * @since 11.0.0 */ - public function getIdentifier() { + public function getIdentifier(): string { return 'deck'; } @@ -50,7 +50,7 @@ class Filter implements \OCP\Activity\IFilter { * @return string A translated string * @since 11.0.0 */ - public function getName() { + public function getName(): string { return $this->l10n->t('Deck'); } @@ -60,7 +60,7 @@ class Filter implements \OCP\Activity\IFilter { * priority values. It is required to return a value between 0 and 100. * @since 11.0.0 */ - public function getPriority() { + public function getPriority(): int { return 90; } @@ -68,7 +68,7 @@ class Filter implements \OCP\Activity\IFilter { * @return string Full URL to an icon, empty string when none is given * @since 11.0.0 */ - public function getIcon() { + public function getIcon(): string { return $this->urlGenerator->imagePath('deck', 'deck-dark.svg'); } @@ -77,7 +77,7 @@ class Filter implements \OCP\Activity\IFilter { * @return string[] An array of allowed apps from which activities should be displayed * @since 11.0.0 */ - public function filterTypes(array $types) { + public function filterTypes(array $types): array { return array_merge($types, ['deck_comment']); } @@ -85,7 +85,7 @@ class Filter implements \OCP\Activity\IFilter { * @return string[] An array of allowed apps from which activities should be displayed * @since 11.0.0 */ - public function allowedApps() { + public function allowedApps(): array { return ['deck']; } } diff --git a/lib/Activity/Setting.php b/lib/Activity/Setting.php index ac1dfed52..e28d1c65e 100644 --- a/lib/Activity/Setting.php +++ b/lib/Activity/Setting.php @@ -41,7 +41,7 @@ class Setting implements \OCP\Activity\ISetting { * @return string Lowercase a-z and underscore only identifier * @since 11.0.0 */ - public function getIdentifier() { + public function getIdentifier(): string { return 'deck'; } @@ -49,7 +49,7 @@ class Setting implements \OCP\Activity\ISetting { * @return string A translated string * @since 11.0.0 */ - public function getName() { + public function getName(): string { return $this->l->t('Changes in the Deck app'); } @@ -59,7 +59,7 @@ class Setting implements \OCP\Activity\ISetting { * priority values. It is required to return a value between 0 and 100. * @since 11.0.0 */ - public function getPriority() { + public function getPriority(): int { return 90; } @@ -67,7 +67,7 @@ class Setting implements \OCP\Activity\ISetting { * @return bool True when the option can be changed for the stream * @since 11.0.0 */ - public function canChangeStream() { + public function canChangeStream(): bool { return true; } @@ -75,7 +75,7 @@ class Setting implements \OCP\Activity\ISetting { * @return bool True when the option can be changed for the stream * @since 11.0.0 */ - public function isDefaultEnabledStream() { + public function isDefaultEnabledStream(): bool { return true; } @@ -83,7 +83,7 @@ class Setting implements \OCP\Activity\ISetting { * @return bool True when the option can be changed for the mail * @since 11.0.0 */ - public function canChangeMail() { + public function canChangeMail(): bool { return true; } @@ -91,7 +91,7 @@ class Setting implements \OCP\Activity\ISetting { * @return bool True when the option can be changed for the stream * @since 11.0.0 */ - public function isDefaultEnabledMail() { + public function isDefaultEnabledMail(): bool { return false; } } diff --git a/lib/Activity/SettingComment.php b/lib/Activity/SettingComment.php index 795437156..8dbaee0ad 100644 --- a/lib/Activity/SettingComment.php +++ b/lib/Activity/SettingComment.php @@ -29,7 +29,7 @@ class SettingComment extends Setting { * @return string Lowercase a-z and underscore only identifier * @since 11.0.0 */ - public function getIdentifier() { + public function getIdentifier(): string { return 'deck_comment'; } @@ -37,7 +37,7 @@ class SettingComment extends Setting { * @return string A translated string * @since 11.0.0 */ - public function getName() { + public function getName(): string { return $this->l->t('A comment was created on a card'); } @@ -45,7 +45,7 @@ class SettingComment extends Setting { * @return bool True when the option can be changed for the stream * @since 11.0.0 */ - public function canChangeStream() { + public function canChangeStream(): bool { return false; } } diff --git a/tests/psalm-baseline.xml b/tests/psalm-baseline.xml index c9c7d7714..2eb5d9228 100644 --- a/tests/psalm-baseline.xml +++ b/tests/psalm-baseline.xml @@ -95,6 +95,11 @@ $labelId + + + $attribute + + VCalendar