diff --git a/UPGRADE-3.0.md b/UPGRADE-3.0.md index c89624125ba4d..cda02388e9d0c 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` no longer implements the `IteratorAggregate` interface. Use the `all()` method instead of iterating over the flash bag. 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()); - } }