From 46680446990b0a320028bb7fd4e6dd653af980c8 Mon Sep 17 00:00:00 2001 From: Patrick Dawkins Date: Mon, 25 Nov 2024 13:40:06 +0000 Subject: [PATCH] Fix typed properties used before initialization and return type for static[] --- src/Connection/Connector.php | 4 ++-- src/Model/ActivityLog/LogItem.php | 2 +- src/Model/ApiResourceBase.php | 4 ++-- src/Model/Backups/RestoreOptions.php | 4 ++-- src/Model/BasicProjectInfo.php | 10 +++++----- .../UserExtendedAccess.php | 2 +- .../UserProjectAccess.php | 2 +- src/Model/Subscription/SubscriptionOptions.php | 18 +++++++++--------- src/PlatformClient.php | 2 +- 9 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/Connection/Connector.php b/src/Connection/Connector.php index 5a35f0d..be7c7f7 100644 --- a/src/Connection/Connector.php +++ b/src/Connection/Connector.php @@ -26,11 +26,11 @@ class Connector implements ConnectorInterface { protected array $config = []; - protected ?ClientInterface $client; + protected ?ClientInterface $client = null; protected $oauthMiddleware; - protected ?AbstractProvider $provider; + protected ?AbstractProvider $provider = null; protected SessionInterface $session; diff --git a/src/Model/ActivityLog/LogItem.php b/src/Model/ActivityLog/LogItem.php index 61fb3a8..6d60494 100644 --- a/src/Model/ActivityLog/LogItem.php +++ b/src/Model/ActivityLog/LogItem.php @@ -46,7 +46,7 @@ public static function singleFromJson(string $str): self|false * @return static[] *@deprecated use LogItem::multipleFromJsonStreamWithSeal() instead */ - public static function multipleFromJsonStream(string $str): static + public static function multipleFromJsonStream(string $str): array { $items = []; foreach (explode("\n", trim($str, "\n")) as $line) { diff --git a/src/Model/ApiResourceBase.php b/src/Model/ApiResourceBase.php index 7d1928b..97b9df0 100644 --- a/src/Model/ApiResourceBase.php +++ b/src/Model/ApiResourceBase.php @@ -34,7 +34,7 @@ abstract class ApiResourceBase implements \ArrayAccess protected bool $isFull = false; - protected ?Collection $parentCollection; + protected ?Collection $parentCollection = null; /** * @param array $data The raw data for the resource @@ -230,7 +230,7 @@ public static function getRequired(): array * * @return static[] */ - public static function getCollection(string $url, int $limit, array $options, ClientInterface $client): static + public static function getCollection(string $url, int $limit, array $options, ClientInterface $client): array { $items = static::getCollectionWithParent($url, $client, $options)['items']; diff --git a/src/Model/Backups/RestoreOptions.php b/src/Model/Backups/RestoreOptions.php index 6b526f0..34cf5c9 100644 --- a/src/Model/Backups/RestoreOptions.php +++ b/src/Model/Backups/RestoreOptions.php @@ -6,9 +6,9 @@ class RestoreOptions { - private ?string $environmentName; + private ?string $environmentName = null; - private ?string $branchFrom; + private ?string $branchFrom = null; private ?bool $restoreCode; diff --git a/src/Model/BasicProjectInfo.php b/src/Model/BasicProjectInfo.php index 7da3e33..e778353 100644 --- a/src/Model/BasicProjectInfo.php +++ b/src/Model/BasicProjectInfo.php @@ -21,15 +21,15 @@ class BasicProjectInfo public string $title; - public ?string $region; + public ?string $region = null; - public ?string $subscription_id; + public ?string $subscription_id = null; - public ?OrganizationRef $organization_ref; + public ?OrganizationRef $organization_ref = null; - public ?string $created_at; + public ?string $created_at = null; - public ?string $status; + public ?string $status = null; public ?string $organization_id; diff --git a/src/Model/CentralizedPermissions/UserExtendedAccess.php b/src/Model/CentralizedPermissions/UserExtendedAccess.php index a88067b..50c901d 100644 --- a/src/Model/CentralizedPermissions/UserExtendedAccess.php +++ b/src/Model/CentralizedPermissions/UserExtendedAccess.php @@ -27,7 +27,7 @@ class UserExtendedAccess extends ResourceWithReferences /** * @return static[] */ - public static function byUser(string $userId, array $options, ClientInterface $client): static + public static function byUser(string $userId, array $options, ClientInterface $client): array { return self::getCollection('/users/' . rawurlencode($userId) . '/extended-access', 0, $options, $client); } diff --git a/src/Model/CentralizedPermissions/UserProjectAccess.php b/src/Model/CentralizedPermissions/UserProjectAccess.php index 2a967cc..e9f43ae 100644 --- a/src/Model/CentralizedPermissions/UserProjectAccess.php +++ b/src/Model/CentralizedPermissions/UserProjectAccess.php @@ -24,7 +24,7 @@ class UserProjectAccess extends ResourceWithReferences /** * @return static[] */ - public static function byUser(string $userId, array $options, ClientInterface $client): static + public static function byUser(string $userId, array $options, ClientInterface $client): array { return self::getCollection('/users/' . rawurlencode($userId) . '/project-access', 0, $options, $client); } diff --git a/src/Model/Subscription/SubscriptionOptions.php b/src/Model/Subscription/SubscriptionOptions.php index 19e355d..54489f2 100644 --- a/src/Model/Subscription/SubscriptionOptions.php +++ b/src/Model/Subscription/SubscriptionOptions.php @@ -7,23 +7,23 @@ final class SubscriptionOptions { - private ?string $project_region; + private ?string $project_region = null; - private ?string $project_title; + private ?string $project_title = null; - private ?string $default_branch; + private ?string $default_branch = null; - private ?string $options_url; + private ?string $options_url = null; - private ?array $options_custom; + private ?array $options_custom = null; - private ?string $plan; + private ?string $plan = null; - private ?int $environments; + private ?int $environments = null; - private ?int $storage; + private ?int $storage = null; - private ?string $owner; + private ?string $owner = null; /** * @deprecated This is no longer supported. Poll the subscription instead of submitting a callback. diff --git a/src/PlatformClient.php b/src/PlatformClient.php index c780aa4..c216832 100644 --- a/src/PlatformClient.php +++ b/src/PlatformClient.php @@ -38,7 +38,7 @@ class PlatformClient /** * @var array|null A per-client cache for account info */ - protected ?array $accountInfo; + protected ?array $accountInfo = null; /** * @var string|false|null A per-client cache for the user ID