From 3128a7b8379809fd20716f0898bb52fe00fd8e0a Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Tue, 22 Jul 2025 16:59:05 +0530 Subject: [PATCH] chore: update to return object --- src/Appwrite/SDK/Method.php | 11 ++--------- src/Appwrite/SDK/Specification/Format/OpenAPI3.php | 8 ++++++-- src/Appwrite/SDK/Specification/Format/Swagger2.php | 8 ++++++-- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/Appwrite/SDK/Method.php b/src/Appwrite/SDK/Method.php index 316b0d6314..945c9e8fae 100644 --- a/src/Appwrite/SDK/Method.php +++ b/src/Appwrite/SDK/Method.php @@ -180,16 +180,9 @@ class Method return $this->deprecated !== false; } - public function getDeprecated(): array|null + public function getDeprecated(): bool|Deprecated { - if ($this->deprecated instanceof Deprecated) { - return [ - 'since' => $this->deprecated->getSince(), - 'replaceWith' => $this->deprecated->getReplaceWith(), - ]; - } - - return null; + return $this->deprecated; } public function isHidden(): bool|array diff --git a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php index ccddbddccd..ea543ef899 100644 --- a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php +++ b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php @@ -3,6 +3,7 @@ namespace Appwrite\SDK\Specification\Format; use Appwrite\SDK\AuthType; +use Appwrite\SDK\Deprecated; use Appwrite\SDK\Method; use Appwrite\SDK\MethodType; use Appwrite\SDK\Response; @@ -170,8 +171,11 @@ class OpenAPI3 extends Format ], ]; - if ($sdk->getDeprecated() !== null) { - $temp['x-appwrite']['deprecated'] = $sdk->getDeprecated(); + if ($sdk->getDeprecated() instanceof Deprecated) { + $temp['x-appwrite']['deprecated'] = [ + 'since' => $sdk->getDeprecated()->getSince(), + 'replaceWith' => $sdk->getDeprecated()->getReplaceWith(), + ]; } if (!empty($additionalMethods)) { diff --git a/src/Appwrite/SDK/Specification/Format/Swagger2.php b/src/Appwrite/SDK/Specification/Format/Swagger2.php index b17a139ea9..bcf14ee9a2 100644 --- a/src/Appwrite/SDK/Specification/Format/Swagger2.php +++ b/src/Appwrite/SDK/Specification/Format/Swagger2.php @@ -3,6 +3,7 @@ namespace Appwrite\SDK\Specification\Format; use Appwrite\SDK\AuthType; +use Appwrite\SDK\Deprecated; use Appwrite\SDK\Method; use Appwrite\SDK\MethodType; use Appwrite\SDK\Response; @@ -174,8 +175,11 @@ class Swagger2 extends Format ], ]; - if ($sdk->getDeprecated() !== null) { - $temp['x-appwrite']['deprecated'] = $sdk->getDeprecated(); + if ($sdk->getDeprecated() instanceof Deprecated) { + $temp['x-appwrite']['deprecated'] = [ + 'since' => $sdk->getDeprecated()->getSince(), + 'replaceWith' => $sdk->getDeprecated()->getReplaceWith(), + ]; } if ($produces) {