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; use Psr\Http\Message\UriInterface;
/** /**
* @property-read string $type * @property-read int $type
* @property-read string $name * @property-read string $name
* @property-read UriInterface $url * @property-read UriInterface $url
* @property-read UriInterface $photo * @property-read UriInterface $photo

View file

@ -62,29 +62,29 @@ class Notification extends BaseDataTransferObject
/** @var string Message (Plaintext) */ /** @var string Message (Plaintext) */
protected $msg_plain; protected $msg_plain;
public function __construct(Notify $Notify) public function __construct(Notify $notify)
{ {
$this->id = $Notify->id; $this->id = $notify->id;
$this->type = $Notify->type; $this->type = $notify->type;
$this->name = $Notify->name; $this->name = $notify->name;
$this->url = $Notify->url->__toString(); $this->url = $notify->url->__toString();
$this->photo = $Notify->photo->__toString(); $this->photo = $notify->photo->__toString();
$this->date = DateTimeFormat::local($Notify->date->format(DateTimeFormat::MYSQL)); $this->date = DateTimeFormat::local($notify->date->format(DateTimeFormat::MYSQL));
$this->msg = $Notify->msg; $this->msg = $notify->msg;
$this->uid = $Notify->uid; $this->uid = $notify->uid;
$this->link = $Notify->link->__toString(); $this->link = $notify->link->__toString();
$this->iid = $Notify->itemId; $this->iid = $notify->itemId;
$this->parent = $Notify->parent; $this->parent = $notify->parent;
$this->seen = $Notify->seen; $this->seen = $notify->seen;
$this->verb = $Notify->verb; $this->verb = $notify->verb;
$this->otype = $Notify->otype; $this->otype = $notify->otype;
$this->name_cache = $Notify->name_cache; $this->name_cache = $notify->name_cache;
$this->msg_cache = $Notify->msg_cache; $this->msg_cache = $notify->msg_cache;
$this->timestamp = $Notify->date->format('U'); $this->timestamp = (int) $notify->date->format('U');
$this->date_rel = Temporal::getRelativeDate($this->date); $this->date_rel = Temporal::getRelativeDate($this->date);
try { 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) { } catch (\Exception $e) {
$this->msg_html = ''; $this->msg_html = '';
} }

View file

@ -20,7 +20,7 @@ class Field extends BaseDataTransferObject
protected $name; protected $name;
/** @var string (HTML) */ /** @var string (HTML) */
protected $value; protected $value;
/** @var string (Datetime)*/ /** @var string|null (Datetime)*/
protected $verified_at; protected $verified_at;
public function __construct(string $name, string $value) public function __construct(string $name, string $value)

View file

@ -44,9 +44,9 @@ class Notification extends BaseDataTransferObject
protected $created_at; protected $created_at;
/** @var bool */ /** @var bool */
protected $dismissed; protected $dismissed;
/** @var Account */ /** @var array */
protected $account; protected $account;
/** @var Status|null */ /** @var array|null */
protected $status = null; protected $status = null;
/** /**

View file

@ -32,7 +32,7 @@ class Poll extends BaseDataTransferObject
/** @var bool|null */ /** @var bool|null */
protected $voted = false; protected $voted = false;
/** @var array|null */ /** @var array|null */
protected $own_votes = false; protected $own_votes = null;
/** @var array */ /** @var array */
protected $options = []; protected $options = [];
/** @var Emoji[] */ /** @var Emoji[] */

View file

@ -18,7 +18,7 @@ use Friendica\Util\Network;
*/ */
class Relationship extends BaseDataTransferObject class Relationship extends BaseDataTransferObject
{ {
/** @var int */ /** @var string */
protected $id; protected $id;
/** @var bool */ /** @var bool */
protected $following = false; protected $following = false;
@ -88,7 +88,5 @@ class Relationship extends BaseDataTransferObject
$this->blocking = (bool)($contactRecord['blocked'] ?? false) || $blocked; $this->blocking = (bool)($contactRecord['blocked'] ?? false) || $blocked;
$this->note = $contactRecord['info']; $this->note = $contactRecord['info'];
} }
return $this;
} }
} }

View file

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

View file

@ -68,7 +68,7 @@ class Status extends BaseDataTransferObject
protected $reblog = null; protected $reblog = null;
/** @var Status[]|null - Akkoma extension, see issue https://github.com/friendica/friendica/issues/12603 */ /** @var Status[]|null - Akkoma extension, see issue https://github.com/friendica/friendica/issues/12603 */
protected $quote = null; protected $quote = null;
/** @var Application */ /** @var array */
protected $application = null; protected $application = null;
/** @var array */ /** @var array */
protected $account; protected $account;