Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0257013

Browse files
committed
minor #22475 [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 | #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()
2 parents 0085a07 + ba65078 commit 0257013

File tree

5 files changed

+19
-11
lines changed

5 files changed

+19
-11
lines changed

UPGRADE-3.3.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ SecurityBundle
313313
--------------
314314

315315
* The `FirewallContext::getContext()` method has been deprecated and will be removed in 4.0.
316-
Use the `getListeners()` method instead.
316+
Use the `getListeners()` and/or `getExceptionListener()` method instead.
317317

318318
* The `FirewallMap::$map` and `$container` properties have been deprecated and will be removed in 4.0.
319319

UPGRADE-4.0.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ Security
434434
SecurityBundle
435435
--------------
436436

437-
* The `FirewallContext::getContext()` method has been removed, use the `getListeners()` method instead.
437+
* The `FirewallContext::getContext()` method has been removed, use the `getListeners()` and/or `getExceptionListener()` method instead.
438438

439439
* The `FirewallMap::$map` and `$container` properties have been removed.
440440

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,22 @@ public function getConfig()
3838
}
3939

4040
/**
41-
* @deprecated since version 3.3, will be removed in 4.0. Use {@link getListeners()} instead.
41+
* @deprecated since version 3.3, will be removed in 4.0. Use {@link getListeners()} and/or {@link getExceptionListener()} instead.
4242
*/
4343
public function getContext()
4444
{
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);
45+
@trigger_error(sprintf('Method %s() is deprecated since version 3.3 and will be removed in 4.0. Use %s::getListeners/getExceptionListener() instead.', __METHOD__, __CLASS__), E_USER_DEPRECATED);
4646

47-
return $this->getListeners();
47+
return array($this->getListeners(), $this->getExceptionListener());
4848
}
4949

5050
public function getListeners()
5151
{
52-
return array($this->listeners, $this->exceptionListener);
52+
return $this->listeners;
53+
}
54+
55+
public function getExceptionListener()
56+
{
57+
return $this->exceptionListener;
5358
}
5459
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public function getListeners(Request $request)
124124
return array(array(), null);
125125
}
126126

127-
return $context->getListeners();
127+
return array($context->getListeners(), $context->getExceptionListener());
128128
}
129129

130130
/**

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,21 @@ public function testGetters()
3232

3333
$context = new FirewallContext($listeners, $exceptionListener, $config);
3434

35-
$this->assertEquals(array($listeners, $exceptionListener), $context->getListeners());
35+
$this->assertEquals($listeners, $context->getListeners());
36+
$this->assertEquals($exceptionListener, $context->getExceptionListener());
3637
$this->assertEquals($config, $context->getConfig());
3738
}
3839

3940
/**
40-
* @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.
41+
* @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/getExceptionListener() instead.
4142
* @group legacy
4243
*/
43-
public function testGetContextTriggersDeprecation()
44+
public function testGetContext()
4445
{
45-
(new FirewallContext(array(), $this->getExceptionListenerMock(), new FirewallConfig('main', 'request_matcher', 'user_checker')))
46+
$context = (new FirewallContext($listeners = array(), $exceptionListener = $this->getExceptionListenerMock(), new FirewallConfig('main', 'request_matcher', 'user_checker')))
4647
->getContext();
48+
49+
$this->assertEquals(array($listeners, $exceptionListener), $context);
4750
}
4851

4952
private function getExceptionListenerMock()

0 commit comments

Comments
 (0)