Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitee66b49

Browse files
committed
[SecurityBundle] Rename FirewallContext#getContext()
1 parent3165e13 commitee66b49

File tree

5 files changed

+42
-8
lines changed

5 files changed

+42
-8
lines changed

‎UPGRADE-3.3.md‎

Lines 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‎

Lines 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‎

Lines 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
publicfunctiongetContext()
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+
publicfunctiongetListeners()
4151
{
4252
returnarray($this->listeners,$this->exceptionListener);
4353
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function getListeners(Request $request)
4646
returnarray(array(),null);
4747
}
4848

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

5252
/**

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

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,7 @@ class FirewallContextTest extends \PHPUnit_Framework_TestCase
2121
publicfunctiontestGetters()
2222
{
2323
$config =newFirewallConfig('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 =newFirewallContext($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+
publicfunctiontestGetContextTriggersDeprecation()
43+
{
44+
(newFirewallContext(array(),$this->getExceptionListenerMock(),newFirewallConfig('main','request_matcher','user_checker')))
45+
->getContext();
46+
}
47+
48+
privatefunctiongetExceptionListenerMock()
49+
{
50+
return$this
51+
->getMockBuilder(ExceptionListener::class)
52+
->disableOriginalConstructor()
53+
->getMock();
54+
}
4255
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp