Add explicit `return null;` statements
authorMatthias Schmidt <gravatronics@live.com>
Tue, 27 Apr 2021 12:59:18 +0000 (14:59 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Tue, 27 Apr 2021 12:59:18 +0000 (14:59 +0200)
.php_cs.dist
files/lib/data/conversation/Conversation.class.php
files/lib/data/conversation/message/ConversationMessage.class.php
files/lib/system/moderation/queue/report/ConversationMessageModerationQueueReportHandler.class.php
files/lib/system/search/ConversationMessageSearch.class.php

index adcc3bef0bcc944d87a43516115fa5ab109f742e..9754205bc16f80f74afa9f18014a23a4cf5f0f01 100644 (file)
@@ -98,7 +98,6 @@ return (new PhpCsFixer\Config())
 
         'no_useless_return' => true,
         'return_assignment' => true,
-        'simplified_null_return' => true,
 
         'multiline_whitespace_before_semicolons' => true,
         'no_empty_statement' => true,
index a008426250c1e216ee44443e599d578c06d96153..6f57567ecdbdc1d6e2b145685a2ee37ea5de674a 100644 (file)
@@ -190,7 +190,7 @@ class Conversation extends DatabaseObject implements IPopoverObject, IRouteContr
      *
      * @param int $conversationID
      * @param int $userID
-     * @return  Conversation
+     * @return  null|Conversation
      */
     public static function getUserConversation($conversationID, $userID)
     {
@@ -206,6 +206,8 @@ class Conversation extends DatabaseObject implements IPopoverObject, IRouteContr
         if ($row !== false) {
             return new self(null, $row);
         }
+
+        return null;
     }
 
     /**
index 9fe307f5fce03c7a6668ccccb5e9dd554cc3c7c6..4746e28fab0f29c328046866514094dc9a315e58 100644 (file)
@@ -72,7 +72,7 @@ class ConversationMessage extends DatabaseObject implements IMessage
      * Assigns and returns the embedded attachments.
      *
      * @param bool $ignoreCache
-     * @return  GroupedAttachmentList
+     * @return  null|GroupedAttachmentList
      */
     public function getAttachments($ignoreCache = false)
     {
@@ -91,6 +91,8 @@ class ConversationMessage extends DatabaseObject implements IMessage
 
             return $attachmentList;
         }
+
+        return null;
     }
 
     /**
index 381e0adb991138e58c1037b05548666f19aaefa8..8edd3c2587694580493c99fad52fd49f38f5821c 100644 (file)
@@ -114,6 +114,8 @@ class ConversationMessageModerationQueueReportHandler extends AbstractModeration
         if ($this->isValid($objectID)) {
             return $this->getMessage($objectID);
         }
+
+        return null;
     }
 
     /**
index e254cd066516c4981c7b468ceecd34b4abd4038e..735f9d3c940ec7f9d470c2ce5c9ded0c2dd2c15a 100644 (file)
@@ -69,6 +69,8 @@ class ConversationMessageSearch extends AbstractSearchableObjectType
         if (isset($this->messageCache[$objectID])) {
             return $this->messageCache[$objectID];
         }
+
+        return null;
     }
 
     /**