8000 minor #27765 [HttpFoundation] update phpdoc of FlashBagInterface::add… · symfony/symfony@1da4252 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1da4252

Browse files
minor #27765 [HttpFoundation] update phpdoc of FlashBagInterface::add() (sir-kain)
This PR was squashed before being merged into the 2.8 branch (closes #27765). Discussion ---------- [HttpFoundation] update phpdoc of FlashBagInterface::add() | Q | A | ------------- | --- | Branch? | 2.8 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - **Reason why I propose to change the docblock like this: ** The `FlashBagInterface::add()` function does not work only with the `string` type in second parameter Commits ------- 9135e18 [HttpFoundation] update phpdoc of FlashBagInterface::add()
2 parents 6e5c15d + 9135e18 commit 1da4252

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ interface FlashBagInterface extends SessionBagInterface
2424
* Adds a flash message for type.
2525
*
2626
* @param string $type
27-
* @param string $message
27+
* @param mixed $message
2828
*/
2929
public function add($type, $message);
3030

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,18 @@ public function testPeek()
7474
$this->assertEquals(array('A previous flash message'), $this->bag->peek('notice'));
7575
}
7676

77+
public function testAdd()
78+
{
79+
$tab = array('bar' => 'baz');
80+
$this->bag->add('string_message', 'lorem');
81+
$this->bag->add('object_message', new \stdClass());
82+
$this->bag->add('array_message', $tab);
83+
84+
$this->assertEquals(array('lorem'), $this->bag->get('string_message'));
85+
$this->assertEquals(array(new \stdClass()), $this->bag->get('object_message'));
86+
$this->assertEquals(array($tab), $this->bag->get('array_message'));
87+
}
88+
7789
public function testGet()
7890
{
7991
$this->assertEquals(array(), $this->bag->get('non_existing'));

0 commit comments

Comments
 (0)
0