From 56faf3fab1a54e1c4ae133299d945898a2cdc699 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Fri, 4 Mar 2022 19:14:03 +0100 Subject: [PATCH] Add proper types to Suspension --- .../lib/data/suspension/Suspension.class.php | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/files/lib/data/suspension/Suspension.class.php b/files/lib/data/suspension/Suspension.class.php index 193cf94..c37076e 100644 --- a/files/lib/data/suspension/Suspension.class.php +++ b/files/lib/data/suspension/Suspension.class.php @@ -18,6 +18,7 @@ use chat\data\room\Room; use chat\data\room\RoomCache; use wcf\data\DatabaseObject; +use wcf\data\object\type\ObjectType; use wcf\data\object\type\ObjectTypeCache; use wcf\data\user\User; use wcf\system\cache\runtime\UserRuntimeCache; @@ -31,10 +32,9 @@ class Suspension extends DatabaseObject implements \JsonSerializable * Returns the active suspensions for the given (objectTypeID, Room, User) * triple. * - * @param int $objectTypeID * @return \chat\data\suspension\Suspension[] */ - public static function getActiveSuspensionsByTriple($objectTypeID, User $user, Room $room) + public static function getActiveSuspensionsByTriple(int $objectTypeID, User $user, Room $room) { $suspensionList = new SuspensionList(); @@ -53,20 +53,16 @@ public static function getActiveSuspensionsByTriple($objectTypeID, User $user, R /** * Returns the suspension object type of this message. - * - * @return \wcf\data\object\type\ObjectType */ - public function getSuspensionType() + public function getSuspensionType(): ObjectType { return ObjectTypeCache::getInstance()->getObjectType($this->objectTypeID); } /** * Returns whether this suspension still is in effect. - * - * @return boolean */ - public function isActive() + public function isActive(): bool { if ($this->revoked !== null) { return false; @@ -85,10 +81,8 @@ public function isActive() /** * Returns the chat room this suspension is in effect. * Returns null if this is a global suspension. - * - * @return \chat\data\room\Room */ - public function getRoom() + public function getRoom(): ?Room { if ($this->roomID === null) { return null; @@ -99,10 +93,8 @@ public function getRoom() /** * Returns the user that is affected by this suspension. - * - * @return \wcf\data\user\User */ - public function getUser() + public function getUser(): User { return UserRuntimeCache::getInstance()->getObject($this->userID); }