From bfafa5450524d3f18fa735f14c97d89206483cd1 Mon Sep 17 00:00:00 2001 From: FlorianLB Date: Mon, 5 Jan 2015 00:01:59 +0100 Subject: [PATCH 1/2] [HttpFoundation] remove deprecated : FlashBag don't implement anymore IteratorAggregate --- UPGRADE-3.0.md | 4 ++++ .../HttpFoundation/Session/Flash/FlashBag.php | 18 +-------------- .../Tests/Session/Flash/FlashBagTest.php | 22 ------------------- 3 files changed, 5 insertions(+), 39 deletions(-) diff --git a/UPGRADE-3.0.md b/UPGRADE-3.0.md index c89624125ba4d..3a64cfd939e77 100644 --- a/UPGRADE-3.0.md +++ b/UPGRADE-3.0.md @@ -1031,3 +1031,7 @@ UPGRADE FROM 2.x to 3.0 ### Swiftmailer Bridge * `Symfony\Bridge\Swiftmailer\DataCollector\MessageDataCollector` was removed. Use the `Symfony\Bundle\SwiftmailerBundle\DataCollector\MessageDataCollector` class instead. + +### HttpFoundation + +* `Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface` don't implement anymore `\IteratorAggregate` interface diff --git a/src/Symfony/Component/HttpFoundation/Session/Flash/FlashBag.php b/src/Symfony/Component/HttpFoundation/Session/Flash/FlashBag.php index bbe7561be7c7c..223d86398e87f 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Flash/FlashBag.php +++ b/src/Symfony/Component/HttpFoundation/Session/Flash/FlashBag.php @@ -14,11 +14,9 @@ /** * FlashBag flash message container. * - * \IteratorAggregate implementation is deprecated and will be removed in 3.0. - * * @author Drak */ -class FlashBag implements FlashBagInterface, \IteratorAggregate +class FlashBag implements FlashBagInterface { private $name = 'flashes'; @@ -165,18 +163,4 @@ public function clear() { return $this->all(); } - - /** - * Returns an iterator for flashes. - * - * @deprecated since version 2.4, to be removed in 3.0. - * - * @return \ArrayIterator An \ArrayIterator instance - */ - public function getIterator() - { - trigger_error('The '.__METHOD__.' method is deprecated since version 2.4 and will be removed in 3.0.', E_USER_DEPRECATED); - - return new \ArrayIterator($this->all()); - } } diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/FlashBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/FlashBagTest.php index bdfd08edbef1e..3d5c06981fd8d 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/FlashBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/FlashBagTest.php @@ -131,26 +131,4 @@ public function testPeekAll() ), $this->bag->peekAll() ); } - - /** - * @covers Symfony\Component\HttpFoundation\Session\Flash\FlashBag::getIterator - */ - public function testLegacyGetIterator() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - - $flashes = array('hello' => 'world', 'beep' => 'boop', 'notice' => 'nope'); - foreach ($flashes as $key => $val) { - $this->bag->set($key, $val); - } - - $i = 0; - foreach ($this->bag as $key => $val) { - $this->assertEquals(array($flashes[$key]), $val); - $i++; - } - - $this->assertEquals(count($flashes), $i); - $this->assertCount(0, $this->bag->all()); - } } From 879d7a4a53307b3ec5c2e59caa45ec1108237fa2 Mon Sep 17 00:00:00 2001 From: FlorianLB Date: Thu, 8 Jan 2015 13:42:38 +0100 Subject: [PATCH 2/2] improve changelog message : use all() method instead --- UPGRADE-3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UPGRADE-3.0.md b/UPGRADE-3.0.md index 3a64cfd939e77..cda02388e9d0c 100644 --- a/UPGRADE-3.0.md +++ b/UPGRADE-3.0.md @@ -1034,4 +1034,4 @@ UPGRADE FROM 2.x to 3.0 ### HttpFoundation -* `Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface` don't implement anymore `\IteratorAggregate` interface +* `Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface` no longer implements the `IteratorAggregate` interface. Use the `all()` method instead of iterating over the flash bag.