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

[SecurityBundle] Rename FirewallContext#getContext() #20417

Conversation

chalasr
Copy link
Member

@chalasr chalasr commented Nov 5, 2016

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.

@FabienPapet
Copy link

Shouldn't the UPGRADE-4.0.md file be updated as well ?

@chalasr
Copy link
Member Author

chalasr commented Nov 5, 2016

@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

@chalasr chalasr force-pushed the securitybundle/deprecate_firewallcontext-getcontext branch from 033da86 to 9482521 Compare November 5, 2016 15:43
@Taluu
Copy link
Contributor

Taluu commented Nov 5, 2016

AFAIK, you need to update it

@chalasr chalasr force-pushed the securitybundle/deprecate_firewallcontext-getcontext branch from 9482521 to ca99176 Compare November 5, 2016 21:32
@chalasr
Copy link
Member Author

chalasr commented Nov 5, 2016

UPGRADE updated. Thanks

@chalasr chalasr force-pushed the securitybundle/deprecate_firewallcontext-getcontext branch from ca99176 to 6b889f0 Compare November 5, 2016 21:34
@javiereguiluz javiereguiluz added this to the 3.2 milestone Nov 7, 2016
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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The %() method is [...]

@xabbuh
Copy link
Member

xabbuh commented Nov 7, 2016

👍

@chalasr chalasr force-pushed the securitybundle/deprecate_firewallcontext-getcontext branch 3 times, most recently from 6c00f60 to b6a29b2 Compare November 7, 2016 20:17
@fabpot fabpot removed this from the 3.2 milestone Nov 16, 2016
@chalasr chalasr force-pushed the securitybundle/deprecate_firewallcontext-getcontext branch from b6a29b2 to 03b330c Compare November 20, 2016 10:18
@chalasr
Copy link
Member Author

chalasr commented Nov 20, 2016

Updated to target 3.3

@chalasr chalasr force-pushed the securitybundle/deprecate_firewallcontext-getcontext branch 3 times, most recently from d309b18 to e91f331 Compare November 24, 2016 19:48
@chalasr chalasr force-pushed the securitybundle/deprecate_firewallcontext-getcontext branch from e91f331 to f09a056 Compare November 24, 2016 23:47
@nicolas-grekas nicolas-grekas added this to the 3.x milestone Dec 6, 2016
@chalasr chalasr force-pushed the securitybundle/deprecate_firewallcontext-getcontext branch from f09a056 to fe775e5 Compare December 8, 2016 22:43
@chalasr chalasr force-pushed the securitybundle/deprecate_firewallcontext-getcontext branch from fe775e5 to ee66b49 Compare December 8, 2016 22:44
@chalasr
Copy link
Member Author

chalasr commented Dec 8, 2016

This is ready to go

SecurityBundle
--------------

* The `FirewallContext::getContext()` method has been removed, use the `getListeners()` method instead.
Copy link
Member

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

@fabpot
Copy link
Member

fabpot commented Dec 9, 2016

Thank you @chalasr.

@fabpot fabpot merged commit ee66b49 into symfony:master Dec 9, 2016
fabpot added a commit that referenced this pull request Dec 9, 2016
…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()
@chalasr chalasr deleted the securitybundle/deprecate_firewallcontext-getcontext branch December 9, 2016 08:37
return $this->getListeners();
}

public function getListeners()
Copy link
Member

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();
Copy link
Member

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)

@nicolas-grekas nicolas-grekas modified the milestones: 3.x, 3.3 Mar 24, 2017
fabpot added a commit that referenced this pull request Apr 26, 2017
… (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()
symfony-splitter pushed a commit to symfony/security-bundle that referenced this pull request Apr 26, 2017
… (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()
@fabpot fabpot mentioned this pull request May 1, 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

9 participants