-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[SecurityBundle] Rename FirewallContext#getContext() #20417
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
[SecurityBundle] Rename FirewallContext#getContext() #20417
Conversation
9ab32f1
to
033da86
Compare
Shouldn't the UPGRADE-4.0.md file be updated as well ? |
@FabienPapet You're right, thought I'm not sure upgrade files are not automatically generated from merged commits, changelog ones seem to be so let's get the confirmation of a core team member |
033da86
to
9482521
Compare
AFAIK, you need to update it |
9482521
to
ca99176
Compare
UPGRADE updated. Thanks |
ca99176
to
6b889f0
Compare
public function getContext() | ||
{ | ||
@trigger_error(sprintf('Method "%s()" is deprecated since version 3.2 and will be removed in 4.0. Use "%s::getListeners()" instead.', __METHOD__, __CLASS__), E_USER_DEPRECATED); |
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 %() method is [...]
👍 |
6c00f60
to
b6a29b2
Compare
b6a29b2
to
03b330c
Compare
Updated to target 3.3 |
d309b18
to
e91f331
Compare
e91f331
to
f09a056
Compare
f09a056
to
fe775e5
Compare
fe775e5
to
ee66b49
Compare
This is ready to go |
SecurityBundle | ||
-------------- | ||
|
||
* The `FirewallContext::getContext()` method has been removed, use the `getListeners()` method instead. |
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 like this line could be wrapped to be in line with the other lines in the file
Thank you @chalasr. |
…chalasr) This PR was merged into the 3.3-dev branch. Discussion ---------- [SecurityBundle] Rename FirewallContext#getContext() | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a As pointed out in #19398 (comment), the name of this method is misleading. Because a public service using this class is created for each defined firewall, I suggest to change it to `FirewallContext#getListeners()`, deprecating the current `getContext()` for removing it in 4.0. Commits ------- ee66b49 [SecurityBundle] Rename FirewallContext#getContext()
return $this->getListeners(); | ||
} | ||
|
||
public function getListeners() |
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 bit confusing considering that this returns both an array of listeners and an exception listener. getListeners
may be expected to return just $this->listeners
public function testGetContextTriggersDeprecation() | ||
{ | ||
(new FirewallContext(array(), $this->getExceptionListenerMock(), new FirewallConfig('main', 'request_matcher', 'user_checker'))) | ||
->getContext(); |
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.
you should also assert the return value, to ensure that the BC layer works fine (returning null would make your test pass, but the class would be broken)
… (ro0NL) This PR was merged into the 3.3-dev branch. Discussion ---------- [SecurityBundle] Enhance FirewallContext::getListeners() | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #20417 (comment), #20417 (comment) | License | MIT | Doc PR | symfony/symfony-docs#... <!--highly recommended for new features--> I think @stof is right.. and the fact we can do this on master currently without the hassle. cc @chalasr Commits ------- ba65078 [SecurityBundle] Enhance FirewallContext::getListeners()
… (ro0NL) This PR was merged into the 3.3-dev branch. Discussion ---------- [SecurityBundle] Enhance FirewallContext::getListeners() | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | symfony/symfony#20417 (comment), symfony/symfony#20417 (comment) | License | MIT | Doc PR | symfony/symfony-docs#... <!--highly recommended for new features--> I think @stof is right.. and the fact we can do this on master currently without the hassle. cc @chalasr Commits ------- ba650783f5 [SecurityBundle] Enhance FirewallContext::getListeners()
As pointed out in #19398 (comment), the name of this method is misleading.
Because a public service using this class is created for each defined firewall, I suggest to change it to
FirewallContext#getListeners()
, deprecating the currentgetContext()
for removing it in 4.0.