From 7ea01733ef3d565198df0f012eb1ac88523e764e Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Tue, 23 Sep 2025 18:28:29 +0530 Subject: [PATCH 1/2] chore: update afterbuild fn --- src/Appwrite/Platform/Modules/Functions/Workers/Builds.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php index 9547a752ef..72736a2c9b 100644 --- a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php +++ b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php @@ -899,7 +899,7 @@ class Builds extends Action Console::log('Build details stored'); - $this->afterBuildSuccess($queueForRealtime, $dbForProject, $deployment); + $this->afterBuildSuccess($queueForRealtime, $dbForProject, $deployment, $runtime); $logs = $deployment->getAttribute('buildLogs', ''); /** Screenshot site */ @@ -1392,11 +1392,12 @@ class Builds extends Action * @param Document $deployment * @return void */ - protected function afterBuildSuccess(Realtime $queueForRealtime, Database $dbForProject, Document &$deployment): void + protected function afterBuildSuccess(Realtime $queueForRealtime, Database $dbForProject, Document &$deployment, array $runtime): void { assert($queueForRealtime instanceof Realtime); assert($dbForProject instanceof Database); assert($deployment instanceof Document); + assert(is_array($runtime)); } protected function getRuntime(Document $resource, string $version): array From 5749b4175356a217f740b584ae3741c2cf7b7cc3 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Wed, 24 Sep 2025 10:00:55 +0530 Subject: [PATCH 2/2] updated to use if throw checks --- .../Modules/Functions/Workers/Builds.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php index 72736a2c9b..f2f3b132aa 100644 --- a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php +++ b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php @@ -1391,13 +1391,22 @@ class Builds extends Action * @param Database $dbForProject * @param Document $deployment * @return void + * @throws Exception */ protected function afterBuildSuccess(Realtime $queueForRealtime, Database $dbForProject, Document &$deployment, array $runtime): void { - assert($queueForRealtime instanceof Realtime); - assert($dbForProject instanceof Database); - assert($deployment instanceof Document); - assert(is_array($runtime)); + if (!($queueForRealtime instanceof Realtime)) { + throw new Exception('queueForRealtime must be an instance of Realtime'); + } + if (!($dbForProject instanceof Database)) { + throw new Exception('dbForProject must be an instance of Database'); + } + if (!($deployment instanceof Document)) { + throw new Exception('deployment must be an instance of Document'); + } + if (!is_array($runtime)) { + throw new Exception('runtime must be an array'); + } } protected function getRuntime(Document $resource, string $version): array