From e4fa1aa4187aac79de1230c2aa1fc38a920bd653 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 27 Jan 2025 22:01:17 -0500 Subject: [PATCH 1/3] Add type hints in Mastodon\Instance --- src/Object/Api/Mastodon/Instance.php | 52 ++++++++++------------------ 1 file changed, 18 insertions(+), 34 deletions(-) diff --git a/src/Object/Api/Mastodon/Instance.php b/src/Object/Api/Mastodon/Instance.php index 161494ae2d..8b1806f1cb 100644 --- a/src/Object/Api/Mastodon/Instance.php +++ b/src/Object/Api/Mastodon/Instance.php @@ -24,40 +24,24 @@ use Friendica\Object\Api\Mastodon\InstanceV2\Configuration; */ class Instance extends BaseDataTransferObject { - /** @var string (URL) */ - protected $uri; - /** @var string */ - protected $title; - /** @var string */ - protected $short_description; - /** @var string */ - protected $description; - /** @var string */ - protected $email; - /** @var string */ - protected $version; - /** @var array */ - protected $urls; - /** @var Stats */ - protected $stats; - /** @var string|null This is meant as a server banner, default Mastodon "thumbnail" is 1600×620px */ - protected $thumbnail = null; - /** @var array */ - protected $languages; - /** @var int */ - protected $max_toot_chars; - /** @var bool */ - protected $registrations; - /** @var bool */ - protected $approval_required; - /** @var bool */ - protected $invites_enabled; - /** @var Configuration */ - protected $configuration; - /** @var Account|null */ - protected $contact_account = null; - /** @var array */ - protected $rules = []; + protected string $uri; + protected string $title; + protected string $short_description; + protected string $description; + protected string $email; + protected string $version; + protected array $urls; + protected Stats $stats; + /** This is meant as a server banner, default Mastodon "thumbnail" is 1600×620px */ + protected ?string $thumbnail = null; + protected array $languages; + protected int $max_toot_chars; + protected bool $registrations; + protected bool $approval_required; + protected bool $invites_enabled; + protected Configuration $configuration; + protected ?Account $contact_account = null; + protected array $rules = []; public function __construct(IManageConfigValues $config, BaseURL $baseUrl, Database $database, Configuration $configuration, ?Account $contact_account, array $rules) { From 186b82d71dad4caa4ab67a91cc829adf95cfa2b6 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 27 Jan 2025 22:01:40 -0500 Subject: [PATCH 2/3] Fix wrong default value for contact_account in Mastodon\Instance --- src/Object/Api/Mastodon/Instance.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Object/Api/Mastodon/Instance.php b/src/Object/Api/Mastodon/Instance.php index 8b1806f1cb..d5e8299304 100644 --- a/src/Object/Api/Mastodon/Instance.php +++ b/src/Object/Api/Mastodon/Instance.php @@ -61,7 +61,7 @@ class Instance extends BaseDataTransferObject $this->approval_required = ($register_policy === Register::APPROVE); $this->invites_enabled = false; $this->configuration = $configuration; - $this->contact_account = $contact_account ?? []; + $this->contact_account = $contact_account; $this->rules = $rules; } } From 56e7b05d999be4e2a694117952e9f2e76c4a3a68 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Tue, 28 Jan 2025 07:35:17 -0500 Subject: [PATCH 3/3] Fix coding style in Object/Api/Mastodon/Instance --- src/Object/Api/Mastodon/Instance.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Object/Api/Mastodon/Instance.php b/src/Object/Api/Mastodon/Instance.php index d5e8299304..baa06c8921 100644 --- a/src/Object/Api/Mastodon/Instance.php +++ b/src/Object/Api/Mastodon/Instance.php @@ -41,7 +41,7 @@ class Instance extends BaseDataTransferObject protected bool $invites_enabled; protected Configuration $configuration; protected ?Account $contact_account = null; - protected array $rules = []; + protected array $rules = []; public function __construct(IManageConfigValues $config, BaseURL $baseUrl, Database $database, Configuration $configuration, ?Account $contact_account, array $rules) {