-
Notifications
You must be signed in to change notification settings - Fork 53
Allow HTTPlug 2.0 #114
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
Allow HTTPlug 2.0 #114
Conversation
We should probably setup travis to test with 1.x and 2.x in each env. |
have a composer --prefer-lowest build with php 7.3? or do we need more than that? |
Build is failing because How should I tackle this? I see two roads:
I would prefer the former, since I don't see how we could implement the latter; it would work only on PHP 7.2+ which has parameter widening, but we will be out of luck in PHP 7/7.1 |
👍 for a new major version that only works with httplug 2. will also keep the testing simpler ;-) |
New major version is OK, but that should go to a 2.x branch as we will probably have multiple, subsequent PRs. |
@sagikazarmark perfectly ok with that! If you can create the branch I'll re-target this PR and add (instead of replace) the branch alias in |
2.x branch is ready ;) |
Current build failure are pretty strange, because they manifest only when restricting the deps with external deps: https://travis-ci.org/php-http/client-common/builds/448853233 Same config without additional requires are green. I'll try to compare the installed deps to find the differences. |
I have different results between CI and local. The base problem seems to be in What should I do? I'm not well versed with PHPSpec... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No longer WIP, please review!
I've added a few comments to clarify what I had to do to make the build green.
@@ -19,17 +16,15 @@ branches: | |||
matrix: | |||
fast_finish: true | |||
include: | |||
- php: 7.1 | |||
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" DEPENDENCIES="doctrine/instantiator:^1.1" | |||
- php: 7.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was previously on PHP 7.1 due to doctrine/istantiator 1.1, which is no longer required. I've added a conflict rule below.
- php: 7.0 | ||
- php: 7.1 | ||
- php: 7.2 | ||
env: COVERAGE=true TEST_COMMAND="composer test-ci" DEPENDENCIES="henrikbjorn/phpspec-code-coverage:^1.0" | ||
- php: 7.2 | ||
env: COVERAGE=true TEST_COMMAND="composer test-ci" DEPENDENCIES="leanphp/phpspec-code-coverage" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a maintained fork of the previous package, which is now abandoned.
@@ -44,9 +39,10 @@ matrix: | |||
env: STABILITY="dev" | |||
|
|||
allow_failures: | |||
# Latest dev is allowed to fail. | |||
- php: 7.3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not working for now, but the issue is on Travis' side. Will work as soon as they fix it.
"php-http/message-factory": "^1.0", | ||
"php-http/message": "^1.6", | ||
"symfony/options-resolver": "^2.6 || ^3.0 || ^4.0" | ||
}, | ||
"require-dev": { | ||
"phpspec/phpspec": "^2.5 || ^3.4 || ^4.2", | ||
"phpspec/phpspec": "^3.4 || ^4.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dropping 2.x which was needed only to run under PHP 5.x
composer.json
Outdated
"guzzlehttp/psr7": "^1.4" | ||
}, | ||
"conflict": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those are lower bounds to avoid issues in CI builds. Should not affect --prefer-lowest
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--prefer-lowest will respect the conflict section. as will other packages, as discussed below. do we use the doctrine/instantiator or sebastian/comparator in our actual code, or only for tests? all things thests should be solved in require-dev rather than here, or we prevent installing this on some systems that are fine with those versions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both packages are needed by the test suite through PHPSpec/Prophecy; the dev deps tree should not have packages in common with the non-dev deps, so it should be fine. I preferred to use conflicts instead of requiring them explicitly because they are both indirect dependencies that could go away at any time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the problem is that conflicts are also respected by applications using this package. meaning that if my project uses an older version of one of the libraries we mark as conflicting here will not be able to install this package because of the conflict.
conflict should only be used to mark versions of packages that may not be run together with this package. they should not be used to control what is installed for development. if this is all only about --prefer-lowest, i think we either need them in require-dev, or if you want to be more explicit, put them in the DEPENDENCIES of .travis.yml only for the lowest version build - that would be the most explicit way of doing it, imho.
composer.json
Outdated
"guzzlehttp/psr7": "^1.4" | ||
}, | ||
"conflict": { | ||
"doctrine/instantiator": "<1.0.5", | ||
"phpspec/prophecy": "<1.8", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does conflict interact with the global require ? Because it's only in conflict for the dev environment, does conflict-dev exist ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sadly conflict-dev does not exist, so we should keep the old behavior (minimum version in require dev), as the runtime library does not conflict with prophecy < 1.8. It's only the tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's possible to simulate conflict-dev by making a dummy package that has exactly one conflict, then require said package in require-dev.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch. i'd prefer requiring prohecy ^1.8 in require-dev over creating a dummy package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ouch I didn't think of this issue! Maybe moving to require-dev is good enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes please set thoses packages into the require dev section instead of using conflict
@@ -11,16 +11,21 @@ | |||
} | |||
], | |||
"require": { | |||
"php": "^5.4 || ^7.0", | |||
"php-http/httplug": "^1.1", | |||
"php": "^7.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not go directly to 7.1? afaik 7.0 is EOL already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it's the same of PSR-18 and HTTPlug 2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im fine with 7.1. For psr18 it did not really matter. It was not using any php7.1 features.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as long as we agree that dropping 7.0 support is a minor change and we "just do it" if 7.0 becomes a pain for some reason, i am fine with allowing it for now ;-)
This PR require us to release a major version. Is this really what we want? We could modify it to allow httplug 1 and 2. That would be an easier migration, right? |
Technically that could work. We should probably consider it. |
Does not work since HttpMethodsClient is not final (so it's a BC break if we change the signature, exactly like the Guzzle package) |
You are correct. I did not consider that this library actually have http-client implementations.
… On 2 Nov 2018, at 17:28, Joel Wurtz ***@***.***> wrote:
Does not work since HttpMethodsClient is not final (so it's a BC break if we change the signature, exactly like the Guzzle package)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Yep, exactly, it's a BC. But users of this lib will be able to require both versions if they want to support both HTTPlug versions. BTW, what do you want me to do regarding the lower bound for Prophecy and doctrine/instantiator? |
I've moved the conflicts to require-dev as per #114 (comment) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me, thanks!
i like that we use >= in the require-dev for the constraints, like this its clear its not regular dependencies.
What's in this PR?
This PR (like php-http/discovery#115) is to test and allow HTTPlug 2 (and PSR-18)
Checklist
To Do