From a0bdb576c30dd48ec653fb6621ce97f19f0d04f5 Mon Sep 17 00:00:00 2001 From: Kim Pepper Date: Wed, 13 Nov 2024 09:40:52 +1100 Subject: [PATCH] Addressed feedback Signed-off-by: Kim Pepper --- util/template/client-class | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/util/template/client-class b/util/template/client-class index 68a20379..f4346b5f 100644 --- a/util/template/client-class +++ b/util/template/client-class @@ -37,8 +37,6 @@ use OpenSearch\Traits\DeprecatedPropertyTrait; class Client { - use DeprecatedPropertyTrait; - const VERSION = '2.3.1'; /** @@ -51,10 +49,12 @@ class Client */ protected $params; - protected EndpointFactoryInterface $endpointFactory; + private EndpointFactoryInterface $endpointFactory; /** * @var callable + * + * @deprecated in 2.3.2 and will be removed in 3.0.0. */ protected $endpoints; @@ -79,7 +79,10 @@ class Client $endpoints = $endpointFactory; $endpointFactory = new LegacyEndpointFactory($endpointFactory); } else { - $endpoints = fn ($c) => $endpointFactory->getEndpoint('OpenSearch\\Endpoints\\' . $c); + $endpoints = function ($c) { + @trigger_error('The $endpoints property is deprecated in 2.3.2 and will be removed in 3.0.0.', E_USER_DEPRECATED); + $endpointFactory->getEndpoint('OpenSearch\\Endpoints\\' . $c); + }; } $this->endpoints = $endpoints; $this->endpointFactory = $endpointFactory; @@ -90,15 +93,10 @@ class Client :functions /** - * Checks for access to deprecated properties. + * Gets the endpoint factory. */ - public function __get(string $name): mixed - { - if ($name === 'endpoints') { - @trigger_error('The $endpoints property is deprecated in 2.3.2 and will be removed in 3.0.0. Use $endpointFactory instead.', E_USER_DEPRECATED); - return $this->endpoints; - } - return null; + protected function getEndpointFactory(): EndpointFactoryInterface { + return $this->endpointFactory; } /**