Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ee66b49

Browse filesBrowse files
committed
[SecurityBundle] Rename FirewallContext#getContext()
1 parent 3165e13 commit ee66b49
Copy full SHA for ee66b49

File tree

5 files changed

+42
-8
lines changed
Filter options

5 files changed

+42
-8
lines changed

‎UPGRADE-3.3.md

Copy file name to clipboardExpand all lines: UPGRADE-3.3.md
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,9 @@ Security
1212

1313
* The `RoleInterface` has been deprecated. Extend the `Symfony\Component\Security\Core\Role\Role`
1414
class in your custom role implementations instead.
15+
16+
SecurityBundle
17+
--------------
18+
19+
* The `FirewallContext::getContext()` method has been deprecated and will be removed in 4.0.
20+
Use the `getListeners()` method instead.

‎UPGRADE-4.0.md

Copy file name to clipboardExpand all lines: UPGRADE-4.0.md
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,11 @@ FrameworkBundle
134134
`serializer.mapping.cache.apc` and `serializer.mapping.cache.doctrine.apc`
135135
have been removed. APCu should now be automatically used when available.
136136

137+
SecurityBundle
138+
--------------
139+
140+
* The `FirewallContext::getContext()` method has been removed, use the `getListeners()` method instead.
141+
137142
HttpFoundation
138143
---------------
139144

‎src/Symfony/Bundle/SecurityBundle/Security/FirewallContext.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/Security/FirewallContext.php
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,17 @@ public function getConfig()
3737
return $this->config;
3838
}
3939

40+
/**
41+
* @deprecated since version 3.3, will be removed in 4.0. Use {@link getListeners()} instead.
42+
*/
4043
public function getContext()
44+
{
45+
@trigger_error(sprintf('Method %s() is deprecated since version 3.3 and will be removed in 4.0. Use %s::getListeners() instead.', __METHOD__, __CLASS__), E_USER_DEPRECATED);
46+
47+
return $this->getListeners();
48+
}
49+
50+
public function getListeners()
4151
{
4252
return array($this->listeners, $this->exceptionListener);
4353
}

‎src/Symfony/Bundle/SecurityBundle/Security/FirewallMap.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/Security/FirewallMap.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function getListeners(Request $request)
4646
return array(array(), null);
4747
}
4848

49-
return $context->getContext();
49+
return $context->getListeners();
5050
}
5151

5252
/**

‎src/Symfony/Bundle/SecurityBundle/Tests/Security/FirewallContextTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/Tests/Security/FirewallContextTest.php
+20-7Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,7 @@ class FirewallContextTest extends \PHPUnit_Framework_TestCase
2121
public function testGetters()
2222
{
2323
$config = new FirewallConfig('main', 'user_checker', 'request_matcher');
24-
25-
$exceptionListener = $this
26-
->getMockBuilder(ExceptionListener::class)
27-
->disableOriginalConstructor()
28-
->getMock();
29-
24+
$exceptionListener = $this->getExceptionListenerMock();
3025
$listeners = array(
3126
$this
3227
->getMockBuilder(ListenerInterface::class)
@@ -36,7 +31,25 @@ public function testGetters()
3631

3732
$context = new FirewallContext($listeners, $exceptionListener, $config);
3833

39-
$this->assertEquals(array($listeners, $exceptionListener), $context->getContext());
34+
$this->assertEquals(array($listeners, $exceptionListener), $context->getListeners());
4035
$this->assertEquals($config, $context->getConfig());
4136
}
37+
38+
/**
39+
* @expectedDeprecation Method Symfony\Bundle\SecurityBundle\Security\FirewallContext::getContext() is deprecated since version 3.3 and will be removed in 4.0. Use Symfony\Bundle\SecurityBundle\Security\FirewallContext::getListeners() instead.
40+
* @group legacy
41+
*/
42+
public function testGetContextTriggersDeprecation()
43+
{
44+
(new FirewallContext(array(), $this->getExceptionListenerMock(), new FirewallConfig('main', 'request_matcher', 'user_checker')))
45+
->getContext();
46+
}
47+
48+
private function getExceptionListenerMock()
49+
{
50+
return $this
51+
->getMockBuilder(ExceptionListener::class)
52+
->disableOriginalConstructor()
53+
->getMock();
54+
}
4255
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.