Skip to content
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

Add getFlashBag method to Session interface. #22395

Conversation

Aliance
Copy link
Contributor

@Aliance Aliance commented Apr 12, 2017

Q A
Branch? 2.8
Bug fix? yes
New feature? no
BC breaks? probably yes
Deprecations? no
Tests pass? ?
Fixed tickets
License MIT
Doc PR

Now, the PHPDoc of Request::getSession method said that it returns the SessionInterface. But the
Session, getting from the Request in WebProfilerBundle uses getFlashBag method, which IDE marks as suspicious (because SessionInterface does knows nothing about it).
So I decided to add that method to symfony Session interface, but mb I should do it at WebProfilerBundle?

Is this change BC or not? I do not sure, someone could implement the session interface, so this will be a BC for them.

2017-04-12 15 40 02

@stof
Copy link
Member

stof commented Apr 12, 2017

Adding a method in an interface is a BC break. So it cannot be done in a minor version.

btw, you opened the PR to master while saying you want it in 2.8. But this does not change the fact about the BC break anyway

@Aliance Aliance changed the base branch from master to 2.8 April 12, 2017 12:41
@Aliance
Copy link
Contributor Author

Aliance commented Apr 12, 2017

btw, you opened the PR to master while saying you want it in 2.8.

My bad, fixed the base branch.

@Aliance
Copy link
Contributor Author

Aliance commented Apr 12, 2017

So it cannot be done in a minor version.

What do you mean? This should be done only for 3.2 and higher?

@chalasr
Copy link
Member

chalasr commented Apr 12, 2017

@Aliance adding a new method to an interface means that any class currently implementing it will break, that's not a backward compatible change. BC breaks are allowed on major versions only (the next one being 4.0 which cannot be targeted until releasing symfony 3.4 so that master becomes the 4.0 development branch) but should be avoided as possible.

@Aliance
Copy link
Contributor Author

Aliance commented Apr 12, 2017

Ok, I understand. So what can you recommend for fixing PHPDoc issue in WebProfilerBundle?

@chalasr
Copy link
Member

chalasr commented Apr 12, 2017

@Aliance I think the right way to make IDEs happy would be to check that the Request::getSession() return value is an instance of Session before calling getFlashBag on it since the SessionInterface does not guarantee this method (and I'm not sure it should, session can live without flashbag).
But I don't know if we want to go this way nor to care about that at all, see #12420 which has been rejected for the very same change.

@Aliance
Copy link
Contributor Author

Aliance commented Apr 12, 2017

Thanks everyone!

@Aliance Aliance closed this Apr 12, 2017
@Aliance Aliance deleted the feature-add_flash_bag_to_session_interface branch April 12, 2017 13:34
@Koc Koc mentioned this pull request Aug 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants