-
Notifications
You must be signed in to change notification settings - Fork 53
[2.0] Add types #117
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
[2.0] Add types #117
Conversation
I think we can also drop docblocks where the type is obvious from the hint. |
Maybe we can do it with PHPCSFixer and the |
Sounds like a good idea. |
@sagikazarmark PHPCSFixer is not installed, and we have StyleCI... How should I proceed? Do we want to maintain StileCI? Or should we use PHPCSFixer all the way and add a separate job/stage on Travis? I should open a separate PR for sure... For now I've fixed the CS of this PR alone, for StyleCI. |
We are working towards pretty ci which relies on phpcsfixer config, so you are free to ignore styleci and use PHPCS fixer only. |
lets for now accept what styleci proposes and fix things when we switch to php-cs-fixer with prettyci. there should be no behaviour change whatsoever for style things, so its not critical. there is an error with a stub in the tests. can you fix that? |
After #120 this has a lot of conflicts. Fixing now... |
I've fixed all the conflicts. I wanted to add |
looks good to me. i was wondering if we need a changelog entry, but i think we should make all those clients final classes and then the type declarations are no relevant change anymore. is there any classes in this PR that we explicitly should not declare final? |
I don't know, you or @sagikazarmark should decide on that. I'll try lo list here all the impacted classes (checks will be used to mark classes made final):
Also, nearly all plugins are impacted, but I want to give another go to adding |
I fixed nearly all specs, but I'm not able to fix it for the public function it_does_not_load_cookie_if_expired(RequestInterface $request, UriInterface $uri, Promise $promise)
{
$cookie = new Cookie('name', 'value', null, 'test.com', false, false, null, (new \DateTime())->modify('-1 day'));
$this->cookieJar->addCookie($cookie);
$request->withAddedHeader('Cookie', 'name=value')->shouldNotBeCalled();
$this->handleRequest($request, function (RequestInterface $requestReceived) use ($request, $promise) {
if (Argument::is($requestReceived)->scoreArgument($request->getWrappedObject())) {
return $promise->getWrappedObject();
}
}, function () {});
} The error is:
Anyone can help me here? |
lets do the |
see also #20 => can you please add a changelog for the abstract class? @sagikazarmark is our expert in phpspec, maybe he can help with the error? |
@dbu changelog updated. I'll wait for help on the |
I feel like being summoned. 😄 Lemme check... |
It's one of my biggest regret that I didn't pay more attention to tests in this repo. We abused spec testing quite a bit.... Anyway, you could try using this line in the breaking examples:
We don't really care about the returned promise in those cases. |
It seems to work, great! Thanks! |
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!
lets merge?
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.
Thanks @Jean85 , outstanding!
What's in this PR?
Another PR toward 2.0
Why?
Because PHP 7.0 is now the required minimum.
Checklist
To Do
: Promise
where possible or it may interfere on how the promises works?