Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
carsonbot commentedJun 1, 2021
Hey! I see that this is your first PR. That is great! Welcome! Symfony has acontribution 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 |
nicolas-grekas left a 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.
thanks for the PR!
src/Symfony/Component/HttpFoundation/Session/Storage/Handler/AbstractSessionHandler.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
| publicfunctiongc($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 letfalse 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 thefalse 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 returningint|false satisfy the@return bool that was assumed. I don't think it makes sense to convert that to aint cast.
derrabus left a 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.
Thank you for your first Symfony contribution,@nikic! 😅
1f91140 to8954b4fComparederrabus commentedJun 1, 2021
Thank you@nikic. |
stof commentedJun 2, 2021
When merging that to the 6.0 branch, I think we should add the actual return type rather than the attribute |
derrabus commentedJun 2, 2021
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 forSessionHandlermethods to satisfy theTentative Return Types RFC. This doesn't cover all classes (e.g.MockPdois also affected), just the ones relating toSessionHandleretc.It's worth noting that the
gc()method is spec'd asint|falseon our side, so I've updated type hints accordingly. The method used to return bool prior to PHP 7.1.