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

Skip to content

Commit 077d4c9

Browse files
committed
feature #46491 Introduce FlashBagAwareSessionInterface (VincentLanglet)
This PR was squashed before being merged into the 6.2 branch. Discussion ---------- Introduce FlashBagAwareSessionInterface | Q | A | ------------- | --- | Branch? | 6.2 for features | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | Fix #41765 | License | MIT | Doc PR | symfony/symfony-docs#... Not needed This solve #41765 People will be able to write ``` $session = $request->getSession(); if ($session instanceof FlashBagAwareSessionInterface) { $session->addFlashBag(...); } ``` This is better than a `instanceof Session` check (which is not working with decoration). Commits ------- 026c748 Introduce FlashBagAwareSessionInterface
2 parents 30596f7 + 026c748 commit 077d4c9

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\HttpFoundation\Session;
13+
14+
use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface;
15+
16+
/**
17+
* Interface for session with a flashbag.
18+
*/
19+
interface FlashBagAwareSessionInterface extends SessionInterface
20+
{
21+
public function getFlashBag(): FlashBagInterface;
22+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class_exists(SessionBagProxy::class);
3030
*
3131
* @implements \IteratorAggregate<string, mixed>
3232
*/
33-
class Session implements SessionInterface, \IteratorAggregate, \Countable
33+
class Session implements FlashBagAwareSessionInterface, \IteratorAggregate, \Countable
3434
{
3535
protected $storage;
3636

0 commit comments

Comments
 (0)