From 9119b4ab221f6cb8dca283d79620cc08b207c3f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Fri, 4 Mar 2022 19:20:58 +0100 Subject: [PATCH] Add proper return types to PageHandlers --- files/lib/system/page/handler/LogPageHandler.class.php | 6 +++--- .../lib/system/page/handler/RoomListPageHandler.class.php | 4 ++-- files/lib/system/page/handler/RoomPageHandler.class.php | 8 ++++---- files/lib/system/page/handler/TRoomPageHandler.class.php | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/files/lib/system/page/handler/LogPageHandler.class.php b/files/lib/system/page/handler/LogPageHandler.class.php index e12e274..a0a2e44 100644 --- a/files/lib/system/page/handler/LogPageHandler.class.php +++ b/files/lib/system/page/handler/LogPageHandler.class.php @@ -35,7 +35,7 @@ final class LogPageHandler extends AbstractLookupPageHandler implements IOnlineL /** * @inheritDoc */ - public function getLink($objectID) + public function getLink($objectID): string { $room = RoomCache::getInstance()->getRoom($objectID); if ($room === null) { @@ -54,7 +54,7 @@ public function getLink($objectID) /** * @inheritDoc */ - public function isVisible($objectID = null) + public function isVisible($objectID = null): bool { if (!WCF::getUser()->userID) { return false; @@ -74,7 +74,7 @@ public function isVisible($objectID = null) /** * @inheritDoc */ - public function getOnlineLocation(Page $page, UserOnline $user) + public function getOnlineLocation(Page $page, UserOnline $user): string { if ($user->pageObjectID === null) { return ''; diff --git a/files/lib/system/page/handler/RoomListPageHandler.class.php b/files/lib/system/page/handler/RoomListPageHandler.class.php index 16fb161..b424085 100644 --- a/files/lib/system/page/handler/RoomListPageHandler.class.php +++ b/files/lib/system/page/handler/RoomListPageHandler.class.php @@ -27,7 +27,7 @@ final class RoomListPageHandler extends AbstractMenuPageHandler /** * @inheritDoc */ - public function getOutstandingItemCount($objectID = null) + public function getOutstandingItemCount($objectID = null): int { $rooms = RoomCache::getInstance()->getRooms(); $users = \array_map(static function (Room $room) { @@ -46,7 +46,7 @@ public function getOutstandingItemCount($objectID = null) /** * @inheritDoc */ - public function isVisible($objectID = null) + public function isVisible($objectID = null): bool { return Room::canSeeAny(); } diff --git a/files/lib/system/page/handler/RoomPageHandler.class.php b/files/lib/system/page/handler/RoomPageHandler.class.php index b1055ae..d21b259 100644 --- a/files/lib/system/page/handler/RoomPageHandler.class.php +++ b/files/lib/system/page/handler/RoomPageHandler.class.php @@ -34,7 +34,7 @@ final class RoomPageHandler extends AbstractLookupPageHandler implements IOnline /** * @inheritDoc */ - public function getOutstandingItemCount($objectID = null) + public function getOutstandingItemCount($objectID = null): int { return \count(RoomCache::getInstance()->getRoom($objectID)->getUsers()); } @@ -42,7 +42,7 @@ public function getOutstandingItemCount($objectID = null) /** * @inheritDoc */ - public function getLink($objectID) + public function getLink($objectID): string { $room = RoomCache::getInstance()->getRoom($objectID); if ($room === null) { @@ -55,7 +55,7 @@ public function getLink($objectID) /** * @inheritDoc */ - public function isVisible($objectID = null) + public function isVisible($objectID = null): bool { if (!WCF::getUser()->userID) { return false; @@ -76,7 +76,7 @@ public function isVisible($objectID = null) /** * @inheritDoc */ - public function getOnlineLocation(Page $page, UserOnline $user) + public function getOnlineLocation(Page $page, UserOnline $user): string { if ($user->pageObjectID === null) { return ''; diff --git a/files/lib/system/page/handler/TRoomPageHandler.class.php b/files/lib/system/page/handler/TRoomPageHandler.class.php index 011f92a..38aec80 100644 --- a/files/lib/system/page/handler/TRoomPageHandler.class.php +++ b/files/lib/system/page/handler/TRoomPageHandler.class.php @@ -27,7 +27,7 @@ trait TRoomPageHandler /** * @inheritDoc */ - public function isValid($objectID) + public function isValid($objectID): bool { $room = RoomCache::getInstance()->getRoom($objectID);