Fix 11 PHPStan errors

This commit is contained in:
Art4 2025-02-25 14:03:52 +00:00
parent cea8cf1f6c
commit f6ac16d513
8 changed files with 27 additions and 29 deletions

View 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

View 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 = '';
}

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

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

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

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

View file

@ -35,7 +35,7 @@ class ScheduledStatus extends BaseDataTransferObject
'in_reply_to_id' => null,
'application_id' => ''
];
/** @var Attachment */
/** @var array */
protected $media_attachments = [];
/**

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