Skip to content

Require a GuzzleHttp\ClientInterface instead of any PSR-18 client (Psr\Http\Client\ClientInterface) - #30

Merged
pavog merged 1 commit into
masterfrom
guzzle-client-interface
Oct 16, 2026
Merged

pavog merged 1 commit into
masterfrom
guzzle-client-interface

Conversation

@pavog

@pavog pavog commented Oct 16, 2026

Copy link
Copy Markdown
Member

ModrinthAPIClient accepted any PSR-18 client (Psr\Http\Client\ClientInterface), but the generated API classes require a Guzzle client (GuzzleHttp\ClientInterface).
Passing a PSR-18 client that is not a Guzzle client therefore always failed with a TypeError inside the generated code:

Aternos\ModrinthApi\Api\ProjectsApi::__construct(): 
Argument #1 ($client) must be of type ?GuzzleHttp\ClientInterface

The constructor and setHttpClient() now require GuzzleHttp\ClientInterface, so the error is reported where the client is passed in. Guzzle clients work exactly as before, and the README already uses a Guzzle client in its example.

@pavog
pavog requested a review from JulianVennen October 16, 2026 14:03
@pavog
pavog merged commit c6cf5f9 into master Oct 16, 2026
4 checks passed
@pavog
pavog deleted the guzzle-client-interface branch October 16, 2026 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants