diff options
author | dartcafe <github@dartcafe.de> | 2022-04-28 09:40:53 +0300 |
---|---|---|
committer | dartcafe <github@dartcafe.de> | 2022-05-03 10:50:23 +0300 |
commit | edbe5a851fff3fc47fe17e87ce76e8d83903654e (patch) | |
tree | 31a54fcc6835be717188e46dac3d1937f05d59a2 | |
parent | 1f5fb07ae625260ebdd88877e6cf5df07eeebc68 (diff) |
cs-fix and psalm
Signed-off-by: dartcafe <github@dartcafe.de>
-rw-r--r-- | composer.json | 2 | ||||
-rw-r--r-- | lib/Model/UserGroup/CurrentUser.php | 1 | ||||
-rw-r--r-- | lib/Model/UserGroup/User.php | 2 | ||||
-rw-r--r-- | lib/Service/CalendarService.php | 20 |
4 files changed, 12 insertions, 13 deletions
diff --git a/composer.json b/composer.json index 9cf03eba..fb7eb49b 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,7 @@ "cs:check": "php-cs-fixer fix --dry-run --diff", "cs:fix": "php-cs-fixer fix", "psalm": "php vendor/vimeo/psalm/psalm --no-diff", - "psalm:fix": "php vendor/vimeo/psalm/psalm --alter --issues=InvalidReturnType,InvalidNullableReturnType,MismatchingDocblockParamType,MismatchingDocblockReturnType,MissingParamType,InvalidFalsableReturnType", + "psalm:fix": "php vendor/vimeo/psalm/psalm --alter --issues=MissingReturnType,InvalidReturnType,InvalidNullableReturnType,MismatchingDocblockParamType,MismatchingDocblockReturnType,MissingParamType,InvalidFalsableReturnType", "psalm:info": "php vendor/vimeo/psalm/psalm --no-diff --show-info=true", "psalm:baseline": "php vendor/vimeo/psalm/psalm --set-baseline=psalm-baseline.xml", "psalm:baseline:update": "php vendor/vimeo/psalm/psalm --update-baseline" diff --git a/lib/Model/UserGroup/CurrentUser.php b/lib/Model/UserGroup/CurrentUser.php index f819ef0c..873ddf50 100644 --- a/lib/Model/UserGroup/CurrentUser.php +++ b/lib/Model/UserGroup/CurrentUser.php @@ -27,7 +27,6 @@ use OCP\IUserSession; use OCA\Polls\Helper\Container; class CurrentUser extends User { - public function __construct( ) { parent::__construct(Container::queryClass(IUserSession::class)->getUser()->getUId()); diff --git a/lib/Model/UserGroup/User.php b/lib/Model/UserGroup/User.php index dc9535fc..e4d5849a 100644 --- a/lib/Model/UserGroup/User.php +++ b/lib/Model/UserGroup/User.php @@ -88,7 +88,7 @@ class User extends UserBase { return $this->description; } - public function getPrincipalUri() { + public function getPrincipalUri(): string { return self::PRINCIPAL_PREFIX . $this->getId(); } /** diff --git a/lib/Service/CalendarService.php b/lib/Service/CalendarService.php index 840f8164..834541ff 100644 --- a/lib/Service/CalendarService.php +++ b/lib/Service/CalendarService.php @@ -27,6 +27,7 @@ namespace OCA\Polls\Service; use DateTime; use OCP\Calendar\ICalendar; use OCP\Calendar\IManager as CalendarManager; +use OCP\Util; use OCA\Polls\Model\CalendarEvent; use OCA\Polls\Db\Preferences; use OCA\Polls\Model\UserGroup\CurrentUser; @@ -60,14 +61,14 @@ class CalendarService { } /** - * getCalendars - + * getCalendars - * * @return ICalendar[] * * @psalm-return list<ICalendar> */ public function getCalendarsForPrincipal(string $userId = ''): array { - if (\OC_Util::getVersion()[0] < 24) { + if (Util::getVersion()[0] < 24) { // deprecated since NC23 $this->calendars = $this->calendarManager->getCalendars(); return $this->calendars; @@ -92,7 +93,7 @@ class CalendarService { * @psalm-return list<CalendarEvent> */ public function getEvents(DateTime $from, DateTime $to): array { - if (\OC_Util::getVersion()[0] < 24) { + if (Util::getVersion()[0] < 24) { // deprecated since NC24 \OC::$server->getLogger()->error('calling legacy version'); return $this->getEventsLegcy($from, $to); @@ -119,8 +120,8 @@ class CalendarService { // TODO: identify possible time zone issues, when handling all day events if (($from->getTimestamp() < $calendarEvent->getEnd()) && ($to->getTimestamp() > $calendarEvent->getStart())) { - } - array_push($events, $calendarEvent); + } + array_push($events, $calendarEvent); } return $events; } @@ -131,15 +132,14 @@ class CalendarService { return $calendar; } } - } /** * getEvents - get events from the user's calendars inside given timespan * * @return CalendarEvent[] - * + * * @deprecated since NC23 - * + * * @psalm-return list<CalendarEvent> */ private function getEventsLegcy(DateTime $from, DateTime $to): array { @@ -163,8 +163,8 @@ class CalendarService { // TODO: identify possible time zone issues, when handling all day events if (($from->getTimestamp() < $calendarEvent->getEnd()) && ($to->getTimestamp() > $calendarEvent->getStart())) { - } - array_push($events, $calendarEvent); + } + array_push($events, $calendarEvent); // array_push($events, $calendarEvent); } } |