Skip to content

Commit

Permalink
chore(psalm): Add type hints to make psalm happy
Browse files Browse the repository at this point in the history
Signed-off-by: Julius H盲rtl <jus@bitgrid.net>
  • Loading branch information
juliushaertl committed Jan 24, 2023
1 parent fd90218 commit 01c2ae2
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 19 deletions.
2 changes: 1 addition & 1 deletion lib/Activity/DeckProvider.php
Expand Up @@ -77,7 +77,7 @@ public function __construct(IURLGenerator $urlGenerator, ActivityManager $activi
* @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();
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Activity/DescriptionSetting.php
Expand Up @@ -29,15 +29,15 @@ 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';
}

/**
* @return string A translated string
* @since 11.0.0
*/
public function getName() {
public function getName(): string {
return $this->l->t('A <strong>card description</strong> inside the Deck app has been changed');
}
}
12 changes: 6 additions & 6 deletions lib/Activity/Filter.php
Expand Up @@ -42,15 +42,15 @@ public function __construct(
* @return string Lowercase a-z and underscore only identifier
* @since 11.0.0
*/
public function getIdentifier() {
public function getIdentifier(): string {
return 'deck';
}

/**
* @return string A translated string
* @since 11.0.0
*/
public function getName() {
public function getName(): string {
return $this->l10n->t('Deck');
}

Expand All @@ -60,15 +60,15 @@ public function getName() {
* 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;
}

/**
* @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');
}

Expand All @@ -77,15 +77,15 @@ public function getIcon() {
* @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']);
}

/**
* @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'];
}
}
14 changes: 7 additions & 7 deletions lib/Activity/Setting.php
Expand Up @@ -41,15 +41,15 @@ public function __construct(IL10N $l) {
* @return string Lowercase a-z and underscore only identifier
* @since 11.0.0
*/
public function getIdentifier() {
public function getIdentifier(): string {
return 'deck';
}

/**
* @return string A translated string
* @since 11.0.0
*/
public function getName() {
public function getName(): string {
return $this->l->t('Changes in the <strong>Deck app</strong>');
}

Expand All @@ -59,39 +59,39 @@ public function getName() {
* 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;
}

/**
* @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;
}

/**
* @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;
}

/**
* @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;
}

/**
* @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;
}
}
6 changes: 3 additions & 3 deletions lib/Activity/SettingComment.php
Expand Up @@ -29,23 +29,23 @@ 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';
}

/**
* @return string A translated string
* @since 11.0.0
*/
public function getName() {
public function getName(): string {
return $this->l->t('A <strong>comment</strong> was created on a card');
}

/**
* @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;
}
}
5 changes: 5 additions & 0 deletions tests/psalm-baseline.xml
Expand Up @@ -95,6 +95,11 @@
<code>$labelId</code>
</ParamNameMismatch>
</file>
<file src="lib/Db/RelationalEntity.php">
<MethodSignatureMismatch occurrences="1">
<code>$attribute</code>
</MethodSignatureMismatch>
</file>
<file src="lib/Db/Stack.php">
<UndefinedClass occurrences="2">
<code>VCalendar</code>
Expand Down

0 comments on commit 01c2ae2

Please sign in to comment.