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

Add support for psr/http-message ^2.0 #719

Merged
merged 6 commits into from Aug 9, 2023
Merged

Conversation

damcou
Copy link
Contributor

@damcou damcou commented Aug 9, 2023

This includes:

Stoux and others added 6 commits July 7, 2023 12:23
The only change in psr/http-message:2.0 introduces return types. As we support php:^7.2 we can also introduce these to support both 1.0 & 2.0.
This also realigns paramater names with their interface definitions to better support named arguments (introduced in php:^8.0).
@damcou damcou changed the title Chore/fix with http message Add support for psr/http-message ^2.0 Aug 9, 2023
@damcou damcou merged commit e218795 into master Aug 9, 2023
11 checks passed
@damcou damcou deleted the chore/fix-with-http-message branch August 9, 2023 12:22
@jacobclarke92
Copy link

Just FYI this actually breaks support with psr/http-message ^1
Probably worth changing composer file to reflect that.
Solution for me was to pin to 3.3.2

Reason why it breaks is because of a bunch of bunch of return type incompatibilities e.g.

Fatal error:  
Declaration of Algolia\AlgoliaSearch\Http\Psr7\Uri::withScheme(string $scheme): Psr\Http\Message\UriInterface must be compatible with Psr\Http\Message\UriInterface::withScheme($scheme)  
in /Users/jacobclarke/Projects/hutchies/vendor/algolia/algoliasearch-client-php/src/Http/Psr7/Uri.php  
on line 439

@Stoux
Copy link

Stoux commented Aug 25, 2023

I've missed that, didn't test it with the lowest version. It does indeed break on psr/http-message:~1.0.0 as it sees the new types as more restrictive and thus deem it incompatible.

@damcou Bumping the requirement to "psr/http-message": "^1.1 || ^2.0", should suffice, otherwise you would have to revert the 2.0 support.

@jacobclarke92 Upgrading psr/http-message to 1.1 (or 2.0) should fix it, if you don't have any dependencies that lock it to 1.0 of course.

@damcou
Copy link
Contributor Author

damcou commented Aug 28, 2023

I've missed that, didn't test it with the lowest version. It does indeed break on psr/http-message:~1.0.0 as it sees the new types as more restrictive and thus deem it incompatible.

@damcou Bumping the requirement to "psr/http-message": "^1.1 || ^2.0", should suffice, otherwise you would have to revert the 2.0 support.

Just released v3.4.1 with this changes which should indeed solve the issue.
Thanks for the suggestion !

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.

None yet

3 participants