]> git.mxchange.org Git - friendica.git/commitdiff
Fix 11 PHPStan errors
authorArt4 <art4@wlabs.de>
Tue, 25 Feb 2025 14:03:52 +0000 (14:03 +0000)
committerArt4 <art4@wlabs.de>
Tue, 25 Feb 2025 14:03:52 +0000 (14:03 +0000)
src/Navigation/Notifications/Entity/Notify.php
src/Object/Api/Friendica/Notification.php
src/Object/Api/Mastodon/Field.php
src/Object/Api/Mastodon/Notification.php
src/Object/Api/Mastodon/Poll.php
src/Object/Api/Mastodon/Relationship.php
src/Object/Api/Mastodon/ScheduledStatus.php
src/Object/Api/Mastodon/Status.php

index 297ecbdd985874c447a73e84251ceeecd6691571..71308772a94ee56d844e657aa586f65fd1258804 100644 (file)
@@ -14,7 +14,7 @@ use Friendica\Core\Renderer;
 use Psr\Http\Message\UriInterface;
 
 /**
- * @property-read string $type
+ * @property-read int $type
  * @property-read string $name
  * @property-read UriInterface $url
  * @property-read UriInterface $photo
index bff10accaeea0b0c94e3f47a2ec99504c50754aa..f83cd9cc2cc96e4c966444c63d6a93fcb3a97d20 100644 (file)
@@ -62,29 +62,29 @@ class Notification extends BaseDataTransferObject
        /** @var string Message (Plaintext) */
        protected $msg_plain;
 
-       public function __construct(Notify $Notify)
+       public function __construct(Notify $notify)
        {
-               $this->id         = $Notify->id;
-               $this->type       = $Notify->type;
-               $this->name       = $Notify->name;
-               $this->url        = $Notify->url->__toString();
-               $this->photo      = $Notify->photo->__toString();
-               $this->date       = DateTimeFormat::local($Notify->date->format(DateTimeFormat::MYSQL));
-               $this->msg        = $Notify->msg;
-               $this->uid        = $Notify->uid;
-               $this->link       = $Notify->link->__toString();
-               $this->iid        = $Notify->itemId;
-               $this->parent     = $Notify->parent;
-               $this->seen       = $Notify->seen;
-               $this->verb       = $Notify->verb;
-               $this->otype      = $Notify->otype;
-               $this->name_cache = $Notify->name_cache;
-               $this->msg_cache  = $Notify->msg_cache;
-               $this->timestamp  = $Notify->date->format('U');
+               $this->id         = $notify->id;
+               $this->type       = $notify->type;
+               $this->name       = $notify->name;
+               $this->url        = $notify->url->__toString();
+               $this->photo      = $notify->photo->__toString();
+               $this->date       = DateTimeFormat::local($notify->date->format(DateTimeFormat::MYSQL));
+               $this->msg        = $notify->msg;
+               $this->uid        = $notify->uid;
+               $this->link       = $notify->link->__toString();
+               $this->iid        = $notify->itemId;
+               $this->parent     = $notify->parent;
+               $this->seen       = $notify->seen;
+               $this->verb       = $notify->verb;
+               $this->otype      = $notify->otype;
+               $this->name_cache = $notify->name_cache;
+               $this->msg_cache  = $notify->msg_cache;
+               $this->timestamp  = (int) $notify->date->format('U');
                $this->date_rel   = Temporal::getRelativeDate($this->date);
 
                try {
-                       $this->msg_html  = BBCode::convertForUriId($Notify->uriId, $this->msg, BBCode::EXTERNAL);
+                       $this->msg_html  = BBCode::convertForUriId($notify->uriId, $this->msg, BBCode::EXTERNAL);
                } catch (\Exception $e) {
                        $this->msg_html  = '';
                }
index cf1983f2fe857e47123e291a3db0221b14d0b63a..846aac4d0f1dacce165b48de65b61e877db15d5a 100644 (file)
@@ -20,7 +20,7 @@ class Field extends BaseDataTransferObject
        protected $name;
        /** @var string (HTML) */
        protected $value;
-       /** @var string (Datetime)*/
+       /** @var string|null (Datetime)*/
        protected $verified_at;
 
        public function __construct(string $name, string $value)
index e5593bfc8255f739196d20813e109491f17f7816..b18a7f1e9e3f0e2d744d960b062bce9119400b08 100644 (file)
@@ -44,9 +44,9 @@ class Notification extends BaseDataTransferObject
        protected $created_at;
        /** @var bool */
        protected $dismissed;
-       /** @var Account */
+       /** @var array */
        protected $account;
-       /** @var Status|null */
+       /** @var array|null */
        protected $status = null;
 
        /**
index 3d2e6c8f25299410104fd8b362f9bd7fab54436c..a17e8c57b5e8a16cd174d157fa052fd564e5c8f8 100644 (file)
@@ -32,7 +32,7 @@ class Poll extends BaseDataTransferObject
        /** @var bool|null */
        protected $voted = false;
        /** @var array|null */
-       protected $own_votes = false;
+       protected $own_votes = null;
        /** @var array */
        protected $options = [];
        /** @var Emoji[] */
index 1d708425cd673823c997ddd97732b8d2d5f55555..2e9faf4d0b04e82da4bc8cc70cbd5ec9f6ba8a38 100644 (file)
@@ -18,7 +18,7 @@ use Friendica\Util\Network;
  */
 class Relationship extends BaseDataTransferObject
 {
-       /** @var int */
+       /** @var string */
        protected $id;
        /** @var bool */
        protected $following = false;
@@ -88,7 +88,5 @@ class Relationship extends BaseDataTransferObject
                        $this->blocking    = (bool)($contactRecord['blocked'] ?? false) || $blocked;
                        $this->note        = $contactRecord['info'];
                }
-
-               return $this;
        }
 }
index ac4bf029c2cd60a26c2a2d4386d15aa7b03a51f2..630ebd78391ec9787c2ce511b75483e093565bfb 100644 (file)
@@ -35,7 +35,7 @@ class ScheduledStatus extends BaseDataTransferObject
                'in_reply_to_id' => null,
                'application_id' => ''
        ];
-       /** @var Attachment */
+       /** @var array */
        protected $media_attachments = [];
 
        /**
index 474db28dc0ba47b7c591a07f5b8a902ba262c854..77b49f685d3ff2ab48a8fd0b022087b84862f092 100644 (file)
@@ -68,7 +68,7 @@ class Status extends BaseDataTransferObject
        protected $reblog = null;
        /** @var Status[]|null - Akkoma extension, see issue https://github.com/friendica/friendica/issues/12603 */
        protected $quote = null;
-       /** @var Application */
+       /** @var array */
        protected $application = null;
        /** @var array */
        protected $account;