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) {