]> git.mxchange.org Git - friendica.git/commitdiff
Update return value type-hint of GServer::getProtocol
authorHypolite Petovan <hypolite@mrpetovan.com>
Sat, 25 Jun 2022 02:37:53 +0000 (22:37 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Sat, 25 Jun 2022 09:06:22 +0000 (05:06 -0400)
- Address https://github.com/friendica/friendica/issues/11630#issuecomment-1164880874

src/Model/GServer.php
src/Worker/Delivery.php

index 6557315add4a9bdd4c322f1528c4cc047063732a..41a776da1cf8f9ca49b66a7a516f87e5962f5cc6 100644 (file)
@@ -2047,10 +2047,10 @@ class GServer
         * Fetch the protocol of the given server
         *
         * @param int $gsid Server id
-        * @return int
+        * @return ?int One of Post\DeliveryData protocol constants or null if unknown or gserver is missing
         * @throws Exception
         */
-       public static function getProtocol(int $gsid): int
+       public static function getProtocol(int $gsid): ?int
        {
                if (empty($gsid)) {
                        return null;
index a3c7dfdb1b6db220e32473e1c6262f37779a83a2..7f64a9d6a21dfd0c0ff6ab3d16191d07818a06c4 100644 (file)
@@ -257,19 +257,19 @@ class Delivery
        /**
         * Deliver content via DFRN
         *
-        * @param string  $cmd             Command
-        * @param array   $contact         Contact record of the receiver
-        * @param array   $owner           Owner record of the sender
-        * @param array   $items           Item record of the content and the parent
-        * @param array   $target_item     Item record of the content
-        * @param boolean $public_message  Is the content public?
-        * @param boolean $top_level       Is it a thread starter?
-        * @param boolean $followup        Is it an answer to a remote post?
-        * @param int     $server_protocol The protocol of the server
+        * @param string   $cmd             Command
+        * @param array    $contact         Contact record of the receiver
+        * @param array    $owner           Owner record of the sender
+        * @param array    $items           Item record of the content and the parent
+        * @param array    $target_item     Item record of the content
+        * @param boolean  $public_message  Is the content public?
+        * @param boolean  $top_level       Is it a thread starter?
+        * @param boolean  $followup        Is it an answer to a remote post?
+        * @param int|null $server_protocol The protocol of the server
         * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         * @throws \ImagickException
         */
-       private static function deliverDFRN(string $cmd, array $contact, array $owner, array $items, array $target_item, bool $public_message, bool $top_level, bool $followup, int $server_protocol)
+       private static function deliverDFRN(string $cmd, array $contact, array $owner, array $items, array $target_item, bool $public_message, bool $top_level, bool $followup, int $server_protocol = null)
        {
                // Transmit Diaspora reshares via Diaspora if the Friendica contact support Diaspora
                if (Diaspora::isReshare($target_item['body'] ?? '') && !empty(FContact::getByURL($contact['addr'], false))) {