elastic / elasticsearch-php

Official PHP client for Elasticsearch.
https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/index.html
MIT License
5.26k stars 966 forks source link

Change typehint for fromConfig in ClientBuilder #1300

Open leonrenkema opened 1 year ago

leonrenkema commented 1 year ago

Hi,

I saw the issue (#1227) where an interface for the Client is added to support mocking in the unittest.

Maybe it is an idea to also let the ClientBuilder have the ClientInterfaceas returntype instead of Client.

https://github.com/elastic/elasticsearch-php/blob/9a734ac64798fe242d49a00d5f335c1cf45429c0/src/ClientBuilder.php#L158

Then it will be possible to Mock the ClientBuilder and let fromConfigreturn a mocked instance.