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 03b330c

Browse filesBrowse files
committed
[SecurityBundle] Rename FirewallContext#getContext()
1 parent b376d92 commit 03b330c
Copy full SHA for 03b330c

File tree

5 files changed

+42
-8
lines changed
Filter options

5 files changed

+42
-8
lines changed

‎UPGRADE-3.2.md

Copy file name to clipboardExpand all lines: UPGRADE-3.2.md
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ FrameworkBundle
2828
* The `Resources/public/css/*.css` files have been removed (they are now inlined
2929
in TwigBundle).
3030

31+
SecurityBundle
32+
--------------
33+
34+
* The `FirewallContext::getContext()` method has been deprecated and will be removed in 4.0.
35+
Use the `getListeners()` method instead.
36+
3137
Console
3238
-------
3339

‎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
@@ -131,6 +131,11 @@ FrameworkBundle
131131
`serializer.mapping.cache.apc` and `serializer.mapping.cache.doctrine.apc`
132132
have been removed. APCu should now be automatically used when available.
133133

134+
SecurityBundle
135+
--------------
136+
137+
* The `FirewallContext::getContext()` method has been removed, use the `getListeners()` method instead.
138+
134139
HttpFoundation
135140
---------------
136141

‎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
@@ -41,7 +41,17 @@ public function getConfig()
4141
return $this->config;
4242
}
4343

44+
/**
45+
* @deprecated since version 3.3, will be removed in 4.0. Use {@link getListeners()} instead.
46+
*/
4447
public function getContext()
48+
{
49+
@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);
50+
51+
return $this->getListeners();
52+
}
53+
54+
public function getListeners()
4555
{
4656
return array($this->listeners, $this->exceptionListener);
4757
}

‎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', 'request_matcher', 'user_checker');
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.2 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.