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 compatibility with curl-client v2 (now relying on PSR17 factories) #339

Merged
merged 4 commits into from Jun 5, 2019

Conversation

shulard
Copy link
Contributor

@shulard shulard commented Jun 3, 2019

Q A
Bug fix? yes
New feature? no
BC breaks? yes
Deprecations? no
Related tickets fix #338
License MIT

What's in this PR?

This PR contains the compatibility with php-http/curl-client v2.

Why?

Installing the bundle with the curl-client will trigger that error now :

Argument 1 passed to Http\Client\Curl\Client::__construct() must be an instance of Psr\Http\Message\ResponseFactoryInterface or null, instance of Nyholm\Psr7\Factory\HttplugFactory given, called in /vagrant/vendor/php-http/httplug-bundle/src/ClientFactory/CurlFactory.php on line 5

Checklist

  • Updated CHANGELOG.md to describe BC breaks / deprecations | new feature | bugfix
  • Documentation pull request created (if not simply a bugfix)

To Do

  • Handle compatibility with curl-client v1 in parallel of v2

@shulard shulard force-pushed the compatibility/curl-client-v2 branch from 83bbce5 to 6f41cd2 Compare June 3, 2019 15:42
@shulard shulard changed the title Compatibility/curl client v2 Add compatibility with curl-client v2 (now relying on PSR17 factories) Jun 3, 2019
@shulard shulard force-pushed the compatibility/curl-client-v2 branch from 6f41cd2 to db5ca50 Compare June 3, 2019 16:29
@dbu
Copy link
Collaborator

dbu commented Jun 4, 2019

i did #340 to remove all the old stuff that is breaking the build (as well as fixing deprecation notices from symfony 4.3)

@dbu
Copy link
Collaborator

dbu commented Jun 4, 2019

can you please rebase on master to hopefully get the build fixed?

The curl-client rely on PSR17 factories, we must use those factories in the client.
This will blacklist the curl-client v1 installation since there is no way to detect which version is installed and adapt the Factory based on that information.
@shulard shulard force-pushed the compatibility/curl-client-v2 branch from c6dd421 to 9a99489 Compare June 4, 2019 10:02
@shulard
Copy link
Contributor Author

shulard commented Jun 4, 2019

Yes I've just made the rebase.

@deguif
Copy link

deguif commented Jun 5, 2019

Is there anything I can do to help merging this one?

@shulard
Copy link
Contributor Author

shulard commented Jun 5, 2019

@deguif maybe yes ! Currently, we can't find the root cause of the travis failed build...

@deguif
Copy link

deguif commented Jun 5, 2019

I think it's the vcr-plugin which requires php-client-common ^2.0. Removing it from composer.json should fix the issue, but maybe not wanted ;)
https://github.com/php-http/vcr-plugin/blob/master/composer.json#L16

@dbu
Copy link
Collaborator

dbu commented Jun 5, 2019

hm, but the bundle allows client-common 2.0. is there another dependency in the same thing that is limited to client-common 1.0?

@deguif
Copy link

deguif commented Jun 5, 2019

Let's investigate this issue more in details ;)

@deguif
Copy link

deguif commented Jun 5, 2019

I think the issue is when requiring php-http/buzz-adapter:^1.0 php-http/guzzle6-adapter:^1.1.1 php-http/react-adapter:^0.2.1 php-http/socket-client:^1.0, httplug:^1.0 is required.

So it's not possible to use php-http/buzz-adapter:^1.0 php-http/guzzle6-adapter:^1.1.1 php-http/react-adapter:^0.2.1 php-http/socket-client:^1.0 and the vcr-plugin which requires explictly php-http/client-common:^2.0 as it would need httplug:^2.0, which is not possible as it was required by some packages at ^1.0

@dbu
Copy link
Collaborator

dbu commented Jun 5, 2019

thanks for the analysis!

then i guess we should remove vcr-plugin from require-dev and only require it in some builds of the matrix (and skip related tests in the other builds by checking for existence of the vcr plugin class) @shulard do you want to try to do that?

@shulard
Copy link
Contributor Author

shulard commented Jun 5, 2019

Yes I try to do that asap.

@deguif
Copy link

deguif commented Jun 5, 2019

I can also do the PR @shulard if you're busy at the moment.
It will probably be longer as I don't know the project currently ')

@shulard
Copy link
Contributor Author

shulard commented Jun 5, 2019

@deguif I just pushed a first try 😄

@deguif
Copy link

deguif commented Jun 5, 2019

Nice all green ;)
This was quick. Thanks @shulard

@shulard shulard force-pushed the compatibility/curl-client-v2 branch from 3ccd3f0 to df4cabb Compare June 5, 2019 09:52
@shulard
Copy link
Contributor Author

shulard commented Jun 5, 2019

Too quick, there was a typo in the .travis.yml file so I just forced push a fix 😄.

@shulard
Copy link
Contributor Author

shulard commented Jun 5, 2019

@dbu it seems ok now. I've added the vcr-plugin in the travis matrix during the tests on httplug 2.x clients. Do you think it's the only build on which it's required ?

@dbu
Copy link
Collaborator

dbu commented Jun 5, 2019

awesome!

can you please add the vcr-plugin to the dev stability and the code-coverage build? the others are fine as is (and for lowest, it could be hiding problems if we have the plugin as it prevents installing with old versions)

Also skip the tests which rely on it when the plugin is not installed. The tests are still executed when check httplug 2.x clients.
@shulard shulard force-pushed the compatibility/curl-client-v2 branch from df4cabb to 4cc03fa Compare June 5, 2019 10:14
@shulard
Copy link
Contributor Author

shulard commented Jun 5, 2019

I've updated the matrix, it still seems ok 😄.

Copy link
Collaborator

@dbu dbu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome, thank you!

@dbu dbu merged commit aed7e5a into php-http:master Jun 5, 2019
@dbu
Copy link
Collaborator

dbu commented Jun 5, 2019

great, i am preparing a release now.

@deguif
Copy link

deguif commented Jun 5, 2019

It seems I got problem now with CachePlugin, as it doesn't support Psr\Http\Message\StreamFactoryInterface

@shulard
Copy link
Contributor Author

shulard commented Jun 5, 2019

@deguif so after the update, you still got the error regarding HttplugFactory ? Same on my side I think...

@shulard
Copy link
Contributor Author

shulard commented Jun 5, 2019

We were a bit too enthousiast regarding that PR...

@deguif
Copy link

deguif commented Jun 5, 2019

With the HttplugFactory probably as it doesn't return the PSR interfaces that were added here.
But on my side it doesn't work either with the Psr17Factory as the cache plugin doesn't support PSR interfaces but the Httplug ones.

@deguif
Copy link

deguif commented Jun 5, 2019

Maybe we could change the constructor and its methods on the CachePlugin to take a Http\Message\StreamFactory or Psr\Http\Message\StreamFactoryInterface as they both return a Psr\Http\Message\StreamInterface with their createStream method.

And given the class is final, the backward compatibility for type-hint is not necessary ;)

What do you think @dbu?

@deguif
Copy link

deguif commented Jun 5, 2019

@shulard @dbu I just opened: php-http/cache-plugin#56 so we can discuss on the issue I previously talked about.

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.

Incompatibility with php-http/curl-client 2.x
3 participants