From 80e9a0498e1a1a2667607fa4b4aca44a7b4590ab Mon Sep 17 00:00:00 2001 From: Prem Palanisamy Date: Fri, 8 May 2026 16:29:18 +0100 Subject: [PATCH] fix: handle SDK 23 nested typed objects (Preferences, Target, MessageStatus) Five runtime bugs missed in the previous regex pass; PHPStan level 8 caught them when checking against the SDK Models. Migration's resource constructors expect plain arrays / strings, not the nested typed objects SDK 23 returns: - \$user->prefs is Preferences object -> use ->data array - \$user->targets is array -> array_map(fn(\$t) => \$t->toArray()) - \$team->prefs same Preferences fix - \$function->specification doesn't exist on FunctionModel any more; read runtimeSpecification ?: buildSpecification (SDK 21 split) - \$site->specification same Site fix - \$message->status is MessageStatus enum -> cast to string via __toString PHPStan level 3 (project default) clean. Level 8 has no remaining SDK type issues across Sources/Destinations/Reader. --- src/Migration/Sources/Appwrite.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Migration/Sources/Appwrite.php b/src/Migration/Sources/Appwrite.php index 9c92fce745..2b5906d887 100644 --- a/src/Migration/Sources/Appwrite.php +++ b/src/Migration/Sources/Appwrite.php @@ -619,8 +619,8 @@ class Appwrite extends Source $user->emailVerification ?? false, $user->phoneVerification ?? false, !$user->status, - $user->prefs ?? [], - $user->targets ?? [], + $user->prefs->data ?? [], + \array_map(fn ($target) => $target->toArray(), $user->targets ?? []), ); $lastDocument = $user->id; @@ -665,7 +665,7 @@ class Appwrite extends Source $teams[] = new Team( $team->id, $team->name, - $team->prefs, + $team->prefs->data, ); $lastDocument = $team->id; @@ -1485,7 +1485,7 @@ class Appwrite extends Source $function->commands ?? '', $function->logging ?? true, $function->scopes ?? [], - $function->specification ?? '', + $function->runtimeSpecification ?: $function->buildSpecification ?: '', ); $functions[] = $convertedFunc; @@ -1972,7 +1972,7 @@ class Appwrite extends Source $message->users ?? [], $message->targets ?? [], $message->data ?? [], - $message->status ?? '', + (string) $message->status, $message->scheduledAt ?? '', $message->deliveredAt ?? '', $message->deliveryErrors ?? [], @@ -2036,7 +2036,7 @@ class Appwrite extends Source $site->outputDirectory ?? '', $site->adapter ?? 'static', $site->fallbackFile ?? '', - $site->specification ?? '', + $site->runtimeSpecification ?: $site->buildSpecification ?: '', $site->deploymentId ?? '' ); $sites[] = $convertedSite;