Skip to content
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

SparkPostResponse incompatible with psr/http-message v2's ResponseInterface #212

Open
shawnlindstrom opened this issue Jun 30, 2023 · 4 comments

Comments

@shawnlindstrom
Copy link

SparkPost (v2.3.0) requires php-http/message which requires either v1 or 2 of psr/http-message. The Psr\Http\Message\ResponseInterface in v2 of psr/http-message added return type hints. Therefore SparkPost\SparkPostResponse which implements the interface is no longer compatible. You'll either need to update SparkPostResponse to be compatible or make psr/http-message v1 a direct dependency.

Thanks!

@enumag
Copy link

enumag commented Sep 5, 2023

Just ran into this as well. In case you want to support both versions of psr/http-message it might be possible to use PHP's #[\ReturnTypeWillChange] attribute withing Sparkpost library.

@eerootsus
Copy link

+1

omarlopesino added a commit to Metadrop/php-sparkpost that referenced this issue Oct 23, 2023
omarlopesino added a commit to Metadrop/php-sparkpost that referenced this issue Oct 23, 2023
@omarlopesino
Copy link

I've created a PR that todes the adaptation to psr http messge 2.0 but with it has a breaking change that can't be avoided due to the interface constraints: the method getBody must return StreamInterface and not the decoded body as an array like is done now.

The PR solves this by creating an additional method named 'getBodyAsJson' so that the libraries that were depending on the getBody method, can change its code to use getBodyAsJson.

Please review, thanks!

@michaellopez
Copy link

Link to @omarlopesino PR #214

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

No branches or pull requests

5 participants