Skip to content

Support PSR-18 #43

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

Merged
merged 7 commits into from
Oct 29, 2018
Merged

Support PSR-18 #43

merged 7 commits into from
Oct 29, 2018

Conversation

Nyholm
Copy link
Member

@Nyholm Nyholm commented Oct 27, 2018

This will require a new major version. We do not have to release 2.0 right after merging this PR but we should release 2.0 this year.

This is just a "technical" BC break. We could consider other changes as well.

src/Client.php Outdated
@@ -24,7 +25,7 @@
*
* @since 1.0
*/
class Client implements HttpClient, HttpAsyncClient
class Client implements HttpClient, HttpAsyncClient, ClientInterface
Copy link
Member

Choose a reason for hiding this comment

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

Would it make sense to let Http\Client\HttpClient extend Psr\Http\Client\ClientInterface? Then, HTTPlug consumers would not have to update their type hints if they are currently using HttpClient instead of a concrete implementation (hopefully they do).

Copy link
Member Author

Choose a reason for hiding this comment

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

It already does. :)

I just added it here to be more explicit.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh.. I got this error.

Class Http\Client\Curl\Client cannot implement previously implemented interface Psr\Http\Client\ClientInterface in /home/travis/build/php-http/curl-client/src/Client.php on line 28

"ext-curl": "*",
"php-http/httplug": "^1.0",
"php-http/httplug": "^2.0",
Copy link
Member Author

Choose a reason for hiding this comment

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

HTTTPlug extends psr/http-client.

@joelwurtz
Copy link
Member

joelwurtz commented Oct 28, 2018

If this require a new major version why not requiring the psr only?

EDIT : In fact may be better in a 3.0 so we let time for people to upgrade to the psr

Copy link
Contributor

@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.

do i see correctly that we use httplug 2.0 to support psr-18 but provide a convenient migration path for code that is based on httplug? should we nonetheless require psr-18 explicitly instead of relying on indirectly getting it through httplug?

@joelwurtz
Copy link
Member

Base on the previous comment by @xabbuh it seems that this is not possible @dbu, as it induces an interface being implemented twice and so it throws an error.

@xabbuh
Copy link
Member

xabbuh commented Oct 29, 2018

yes, see https://3v4l.org/Drbl2

@xabbuh
Copy link
Member

xabbuh commented Oct 29, 2018

We should probably create a 1.x branch before merging here and add a branch alias entry in the composer.json file here.

@dbu
Copy link
Contributor

dbu commented Oct 29, 2018

i created the 1.7 branch from current master, and added the branch alias to this PR.

composer.json Outdated
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Looks likes this line has to be removed.

Copy link
Contributor

Choose a reason for hiding this comment

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

🤦‍♂️ removed it

@dbu dbu merged commit 0681df1 into master Oct 29, 2018
@dbu dbu deleted the psr-18 branch October 29, 2018 21:13
@dbu
Copy link
Contributor

dbu commented Oct 29, 2018

\o/

@dbu dbu mentioned this pull request Jan 24, 2019
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.

5 participants