Improve code for better variable type detection
authorMatthias Schmidt <gravatronics@live.com>
Sun, 26 Nov 2017 16:01:55 +0000 (17:01 +0100)
committerMatthias Schmidt <gravatronics@live.com>
Sun, 26 Nov 2017 16:01:55 +0000 (17:01 +0100)
wcfsetup/install/files/lib/data/user/trophy/UserTrophyAction.class.php
wcfsetup/install/files/lib/system/user/notification/event/TTestableLikeUserNotificationEvent.class.php

index afa8ecb3a2397f79a0bd38f82594c497cc7f9d1c..c8dc7ab6dbca891b47a5b0955fcf88b6b239e2d3 100644 (file)
@@ -39,10 +39,11 @@ class UserTrophyAction extends AbstractDatabaseObjectAction {
         * @inheritDoc
         */
        public function create() {
-               $returnValues = parent::create();
+               /** @var UserTrophy $userTrophy */
+               $userTrophy = parent::create();
                
-               if (!$returnValues->getTrophy()->isDisabled()) {
-                       $userAction = new UserAction([$returnValues->userID], 'update', [
+               if (!$userTrophy->getTrophy()->isDisabled()) {
+                       $userAction = new UserAction([$userTrophy->userID], 'update', [
                                'counters' => [
                                        'trophyPoints' => 1
                                ]
@@ -50,13 +51,13 @@ class UserTrophyAction extends AbstractDatabaseObjectAction {
                        $userAction->executeAction(); 
                }
                
-               UserActivityEventHandler::getInstance()->fireEvent('com.woltlab.wcf.userTrophy.recentActivityEvent.trophyReceived', $returnValues->getObjectID(), null, $returnValues->userID);
+               UserActivityEventHandler::getInstance()->fireEvent('com.woltlab.wcf.userTrophy.recentActivityEvent.trophyReceived', $userTrophy->getObjectID(), null, $userTrophy->userID);
                
-               UserNotificationHandler::getInstance()->fireEvent('received', 'com.woltlab.wcf.userTrophy.notification', new UserTrophyNotificationObject($returnValues), [
-                       $returnValues->userID
+               UserNotificationHandler::getInstance()->fireEvent('received', 'com.woltlab.wcf.userTrophy.notification', new UserTrophyNotificationObject($userTrophy), [
+                       $userTrophy->userID
                ]);
                
-               return $returnValues
+               return $userTrophy
        }
        
        /**
index b133d32910c60a4353199c862a7eed11f7a05489..1277e84647d1286507d0432ef91760236d8db150 100644 (file)
@@ -64,6 +64,7 @@ trait TTestableLikeUserNotificationEvent {
         * @return      LikeUserNotificationObject[]
         */
        public static function getTestObjects(UserProfile $recipient, UserProfile $author) {
+               /** @var ILikeObject $likeObject */
                $likeObject = self::createTestLikeObject($recipient, $author);
                $likeObject->setObjectType(LikeHandler::getInstance()->getObjectType(self::getTestLikeableObjectTypeName()));