-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpFoundation] Add ReturnTypeWillChange to SessionHandlers #41495
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
Conversation
Hey! I see that this is your first PR. That is great! Welcome! Symfony has a contribution guide which I suggest you to read. In short:
Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change. When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor! I am going to sit back now and wait for the reviews. Cheers! Carsonbot |
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 for the PR!
src/Symfony/Component/HttpFoundation/Session/Storage/Handler/AbstractSessionHandler.php
Outdated
Show resolved
Hide resolved
public function gc($maxlifetime) | ||
{ | ||
return (bool) $this->handler->gc($maxlifetime); | ||
return (int) $this->handler->gc($maxlifetime); |
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.
should we remove the cast to let false
get through?
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.
I've adjusted this to pass through the false
return value. I would be happy to just drop it completely though, I'm not sure why these casts are present.
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.
I would say the cast was there to make implementations returning int|false
satisfy the @return bool
that was assumed. I don't think it makes sense to convert that to a int
cast.
2528bfc
to
2247d0b
Compare
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.
Thank you for your first Symfony contribution, @nikic! 😅
1f91140
to
8954b4f
Compare
Thank you @nikic. |
When merging that to the 6.0 branch, I think we should add the actual return type rather than the attribute |
Following the discussion on #41290, I suggest to merge these changes up as-is until we are able to trigger deprecation warnings based on the attribute. |
This adds
#[ReturnTypeWillChange]
annotations forSessionHandler
methods to satisfy the Tentative Return Types RFC. This doesn't cover all classes (e.g.MockPdo
is also affected), just the ones relating toSessionHandler
etc.It's worth noting that the
gc()
method is spec'd asint|false
on our side, so I've updated type hints accordingly. The method used to return bool prior to PHP 7.1.