8000 feature #13258 [HttpFoundation] remove deprecated : FlashBag don't im… · symfony/symfony@2e496e1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2e496e1

Browse files
committed
feature #13258 [HttpFoundation] remove deprecated : FlashBag don't implement anymore IteratorAggregate (FlorianLB)
This PR was squashed before being merged into the 3.0-dev branch (closes #13258). Discussion ---------- [HttpFoundation] remove deprecated : FlashBag don't implement anymore IteratorAggregate | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | -- | License | MIT | Doc PR | -- Commits ------- 69a556d [HttpFoundation] remove deprecated : FlashBag don't implement anymore IteratorAggregate
2 parents d169e84 + 69a556d commit 2e496e1

File tree

3 files changed

+5
-39
lines changed

3 files changed

+5
-39
lines changed

UPGRADE-3.0.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,3 +1031,7 @@ UPGRADE FROM 2.x to 3.0
10311031
### Swiftmailer Bridge
10321032

10331033
* `Symfony\Bridge\Swiftmailer\DataCollector\MessageDataCollector` was removed. Use the `Symfony\Bundle\SwiftmailerBundle\DataCollector\MessageDataCollector` class instead.
1034+
1035+
### HttpFoundation
1036+
1037+
* `Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface` no longer implements the `IteratorAggregate` interface. Use the `all()` method instead of iterating over the flash bag.

src/Symfony/Component/HttpFoundation/Session/Flash/FlashBag.php

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,9 @@
1414
/**
1515
* FlashBag flash message container.
1616
*
17-
* \IteratorAggregate implementation is deprecated and will be removed in 3.0.
18-
*
1917
* @author Drak <drak@zikula.org>
2018
*/
21-
class FlashBag implements FlashBagInterface, \IteratorAggregate
19+
class FlashBag implements FlashBagInterface
2220
{
2321
private $name = 'flashes';
2422

@@ -165,18 +163,4 @@ public function clear()
165163
{
166164
return $this->all();
167165
}
168-
169-
/**
170-
* Returns an iterator for flashes.
171-
*
172-
* @deprecated since version 2.4, to be removed in 3.0.
173-
*
174-
* @return \ArrayIterator An \ArrayIterator instance
175-
*/
176-
public function getIterator()
177-
{
178-
trigger_error('The '.__METHOD__.' method is deprecated since version 2.4 and will be removed in 3.0.', E_USER_DEPRECATED);
179-
180-
return new \ArrayIterator($this->all());
181-
}
182166
}

src/Symfony/Component/HttpFoundation/Tests/Session/Flash/FlashBagTest.php

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -131,26 +131,4 @@ public function testPeekAll()
131131
), $this->bag->peekAll()
132132
);
133133
}
134-
135-
/**
136-
* @covers Symfony\Component\HttpFoundation\Session\Flash\FlashBag::getIterator
137-
*/
138-
public function testLegacyGetIterator()
139-
{
140-
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
141-
142-
$flashes = array('hello' => 'world', 'beep' => 'boop', 'notice' => 'nope');
143-
foreach ($flashes as $key => $val) {
144-
$this->bag->set($key, $val);
145-
}
146-
147-
$i = 0;
148-
foreach ($this->bag as $key => $val) {
149-
$this->assertEquals(array($flashes[$key]), $val);
150-
$i++;
151-
}
152-
153-
$this->assertEquals(count($flashes), $i);
154-
$this->assertCount(0, $this->bag->all());
155-
}
156134
}

0 commit comments

Comments
 (0)
0