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

Update PSR dependency #511

Closed
wants to merge 1 commit into from
Closed

Update PSR dependency #511

wants to merge 1 commit into from

Conversation

cracksalad
Copy link

Allow usage of psr/http-message v2.0.

When using reactphp/http composer outdated shows:

psr/http-message 1.1   2.0   Common interface for HTTP messages

and composer why psr/http-message says:

react/http       v1.9.0     requires psr/http-message (^1.0)
ringcentral/psr7 1.3.0      requires psr/http-message (~1.0)

So as long as #485 is not resolved (and ringcentral/psr7 is not updated), this PR does not change anything.

For compatibility concerns see PSR Meta Document. The new version restriction still allows to use psr/http-message v1.0 and v1.1 if e.g. newer versions are not compatible with your PHP version, but it also allows to use v2.0.

@SimonFrings
Copy link
Member

Hey @cracksalad, thanks for your input on the psr/http-message v2 topic. I opened a ticket to add support for psr/http-message v2 in #513. This ticket should include all necessary information for the v2 upgrade.

You're right that we first need to remove the dependency on ringcentral/psr7 in order to proceed with upgrading to psr/http-message v2. The upgrade though will also include some workarounds for older PHP versions with additional tests, so just including the version in the composer.json won't do it.

I'll close this PR for now, as the suggested change won't work with the current project setup. Further discussion will happen in #513.

@cracksalad
Copy link
Author

@SimonFrings

The upgrade though will also include some workarounds for older PHP versions with additional tests, so just including the version in the composer.json won't do it.

A "psr/http-message": "^1.0 || ^2.0" would allow composer to update to v2 if your setup (especially PHP itself) supports it. If it does not, composer just would not update and continue to use v1. So there should not be any problem with older PHP versions. The one case that could be problematic is, if reactphp/http is not fully compatible with psr/http-message v2 e.g. because of type issues.
Is there anything I am missing? I am just a bit confused by your explanation. Other than that I am totally fine with your rearrangement of PRs and issues.

@WyriHaximus
Copy link
Member

@cracksalad In short the PSR-7 implementation we're currently using isn't compatible with v2, which should change in v3 of this package. (We're skipping v2 and are going to jump to v3 while also bumping the minimum PHP version and a whole lot of other changes.)

@SimonFrings
Copy link
Member

The one case that could be problematic is, if reactphp/http is not fully compatible with psr/http-message v2 e.g. because of type issues.

@cracksalad This is the case here, like @WyriHaximus said, we're currently using their interfaces in a few classes, which are not compatible to the v2. For example, one thing we need to add for compatibility are return types as described in https://www.php-fig.org/psr/psr-7/meta/#72-type-additions.

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