-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Types missmatches for the client configuration #77
Comments
Using the code below fixes the issue:
|
Hey there, I'll investigate and report back |
Hello, thanks a lot. FTR I got the issue using
Example at https://github.com/ragusa87/TypesenseBundle/blob/main/composer.json |
Hey there, could you update your |
I will try to have a look today, thanks a lot for the fix. |
Hello @tharropoulos, I still have the same issue with your MR. To me the issue is that the declaration below is not valid with older versions of HttpClient (<2.4 PSR-18)
I think you can just fix the requirements, because you still expect the ClientInterface to be implementing HttpClient at the same time. } elseif ($config['client'] instanceof HttpClient || $config['client'] instanceof ClientInterface) {
$this->client = new HttpMethodsClient(
$config['client'],
Psr17FactoryDiscovery::findRequestFactory(),
Psr17FactoryDiscovery::findStreamFactory()
); There was 1 error:
1) Biblioteca\TypesenseBundle\Tests\ContainerTest::testClientFactory
TypeError: Http\Client\Common\HttpMethodsClient::__construct(): Argument #1 ($httpClient) must be of type Http\Client\HttpClient, Symfony\Component\HttpClient\Psr18Client given, called in /home/runner/work/TypesenseBundle/TypesenseBundle/vendor/typesense/typesense-php/src/Lib/Configuration.php on line 111
/home/runner/work/TypesenseBundle/TypesenseBundle/vendor/php-http/client-common/src/HttpMethodsClient.php:43
/home/runner/work/TypesenseBundle/TypesenseBundle/vendor/typesense/typesense-php/src/Lib/Configuration.php:111
/home/runner/work/TypesenseBundle/TypesenseBundle/vendor/typesense/typesense-php/src/Client.php:97
/home/runner/work/TypesenseBundle/TypesenseBundle/src/Client/ClientFactory.php:29
|
Could you also check again? Made some changes, and they seemed to work on act |
Hello @tharropoulos , I ran the tests again on my side and it works indeed. Thanks a lot ! |
Description
Passing an instance of PSR-18
ClientInterface
to the configuration fails.Steps to reproduce
Expected Behavior
You should be able to use the client
Actual Behavior
It seems that the configuration expects a
ClientInterface
But the
getClient
method, will pass theClientInterface
toHttpsMethodsClient
that expect anHttpClient
.Meaning that currently you need to pass an implementation compatible with both PSR-7 & PSR-18 standards.
Metadata
Typesense Version:
v4.9.0
OS:
Linux
The text was updated successfully, but these errors were encountered: