Fix 10 PHPStan errors

This commit is contained in:
Art4 2025-02-26 13:00:50 +00:00
parent f64660ec25
commit b6312f1dfc
4 changed files with 16 additions and 9 deletions

View 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'];

View 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));

View 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 */

View 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;