]> git.mxchange.org Git - friendica.git/commitdiff
Fix 10 PHPStan errors
authorArt4 <art4@wlabs.de>
Wed, 26 Feb 2025 13:00:50 +0000 (13:00 +0000)
committerArt4 <art4@wlabs.de>
Wed, 26 Feb 2025 13:00:50 +0000 (13:00 +0000)
src/Module/Api/Mastodon/Search.php
src/Module/Api/Twitter/Lists/Ownership.php
src/Module/Conversation/Network.php
src/Module/Filer/RemoveTag.php

index 9301c60cdcf36733ba3e7fa4ad37faed2b4a8860..c054329ddea6598fd5f63cc81fc36333c9b03381 100644 (file)
@@ -196,6 +196,11 @@ class Search extends BaseApi
                $tags = DBA::select('tag', ['name'], $condition, $params);
 
                $hashtags = [];
+
+               if (!is_iterable($tags)) {
+                       return $hashtags;
+               }
+
                foreach ($tags as $tag) {
                        if ($version == 1) {
                                $hashtags[] = $tag['name'];
index bdf34ed28092dbe766f5b7f0552c4db0085220c7..0b18f6bc18d804cbe4d34aec641852efd724ae06 100644 (file)
@@ -48,8 +48,11 @@ class Ownership extends BaseApi
 
                // loop through all circles
                $lists = [];
-               foreach ($circles as $circle) {
-                       $lists[] = $this->friendicaCircle->createFromId($circle['id']);
+
+               if (is_iterable($circles)) {
+                       foreach ($circles as $circle) {
+                               $lists[] = $this->friendicaCircle->createFromId($circle['id']);
+                       }
                }
 
                $this->response->addFormattedContent('statuses', ['lists' => ['lists' => $lists]], $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
index 86c2fcf736f3cbb675d3532a63b43178dcee32c7..629295f7c88eb8236ef687727b48be604d821d6d 100644 (file)
@@ -59,9 +59,9 @@ class Network extends Timeline
        protected $dateFrom;
        /** @var string */
        protected $dateTo;
-       /** @var int */
+       /** @var bool */
        protected $star;
-       /** @var int */
+       /** @var bool */
        protected $mention;
 
        /** @var AppHelper */
index 330f6953a63e8593cd1647ad83f898ca4b892e22..28666c8a44059bede1806a767486ae7b21b92be5 100644 (file)
@@ -11,7 +11,6 @@ use Friendica\App;
 use Friendica\BaseModule;
 use Friendica\Core\L10n;
 use Friendica\Core\Session\Capability\IHandleUserSessions;
-use Friendica\Core\System;
 use Friendica\Database\DBA;
 use Friendica\Model\Post;
 use Friendica\Module\Response;
@@ -59,15 +58,15 @@ class RemoveTag extends BaseModule
        }
 
        /**
-        * @param array       $request The $_REQUEST array
-        * @param string|null $type    Output parameter with the computed type
-        * @param string|null $term    Output parameter with the computed term
+        * @param array           $request The $_REQUEST array
+        * @param string|int|null $type    Output parameter with the computed type
+        * @param string|null     $term    Output parameter with the computed term
         *
         * @return int The relevant HTTP code
         *
         * @throws \Exception
         */
-       private function removeTag(array $request, string &$type = null, string &$term = null): int
+       private function removeTag(array $request, &$type = null, string &$term = null): int
        {
                $item_id = $this->parameters['id'] ?? 0;