diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/session.php b/src/Symfony/Bundle/FrameworkBundle/Resources/config/session.php index bef83c3c0162d..80d0682ee4c7e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/session.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/session.php @@ -17,6 +17,7 @@ use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface; use Symfony\Component\HttpFoundation\Session\Session; use Symfony\Component\HttpFoundation\Session\SessionFactory; +use Symfony\Component\HttpFoundation\Session\SessionFactoryInterface; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\HttpFoundation\Session\Storage\Handler\AbstractSessionHandler; use Symfony\Component\HttpFoundation\Session\Storage\Handler\IdentityMarshaller; @@ -32,6 +33,7 @@ use Symfony\Component\HttpFoundation\Session\Storage\PhpBridgeSessionStorage; use Symfony\Component\HttpFoundation\Session\Storage\PhpBridgeSessionStorageFactory; use Symfony\Component\HttpFoundation\Session\Storage\ServiceSessionFactory; +use Symfony\Component\HttpFoundation\Session\Storage\SessionStorageFactoryInterface; use Symfony\Component\HttpFoundation\Session\Storage\SessionStorageInterface; use Symfony\Component\HttpKernel\EventListener\SessionListener; @@ -47,6 +49,7 @@ service('session.storage.factory'), [service('session_listener'), 'onSessionUsage'], ]) + ->alias(SessionFactoryInterface::class, 'session.factory') ->set('session.storage.factory.native', NativeSessionStorageFactory::class) ->args([ @@ -84,6 +87,7 @@ service('session.storage'), ]) ->deprecate('symfony/framework-bundle', '5.3', 'The "%service_id%" service is deprecated, use "session.storage.factory.native", "session.storage.factory.php_bridge" or "session.storage.factory.mock_file" instead.') + ->alias(SessionStorageFactoryInterface::class, 'session.storage.factory') ->set('.session.deprecated', SessionInterface::class) // to be removed in 6.0 ->factory([inline_service(DeprecatedSessionFactory::class)->args([service('request_stack')]), 'getSession']) diff --git a/src/Symfony/Component/HttpFoundation/CHANGELOG.md b/src/Symfony/Component/HttpFoundation/CHANGELOG.md index d6a57aae1400f..c18fc7f327235 100644 --- a/src/Symfony/Component/HttpFoundation/CHANGELOG.md +++ b/src/Symfony/Component/HttpFoundation/CHANGELOG.md @@ -4,7 +4,7 @@ CHANGELOG 5.3 --- - * Add the `SessionFactory`, `NativeSessionStorageFactory`, `PhpBridgeSessionStorageFactory` and `MockFileSessionStorageFactory` classes + * Add the `SessionFactoryInterface` and `SessionStorageFactoryInterface`, and add the `SessionFactory`, `NativeSessionStorageFactory`, `PhpBridgeSessionStorageFactory` and `MockFileSessionStorageFactory` classes that implements these interfaces * Calling `Request::getSession()` when there is no available session throws a `SessionNotFoundException` * Add the `RequestStack::getSession` method * Deprecate the `NamespacedAttributeBag` class diff --git a/src/Symfony/Component/HttpFoundation/Session/SessionFactory.php b/src/Symfony/Component/HttpFoundation/Session/SessionFactory.php index a9982ed0c3f54..fcfe98378bc09 100644 --- a/src/Symfony/Component/HttpFoundation/Session/SessionFactory.php +++ b/src/Symfony/Component/HttpFoundation/Session/SessionFactory.php @@ -20,7 +20,7 @@ class_exists(Session::class); /** * @author Jérémy Derussé */ -class SessionFactory +class SessionFactory implements SessionFactoryInterface { private $requestStack; private $storageFactory; diff --git a/src/Symfony/Component/HttpFoundation/Session/SessionFactoryInterface.php b/src/Symfony/Component/HttpFoundation/Session/SessionFactoryInterface.php new file mode 100644 index 0000000000000..dc1deee28469f --- /dev/null +++ b/src/Symfony/Component/HttpFoundation/Session/SessionFactoryInterface.php @@ -0,0 +1,23 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpFoundation\Session; + +/** + * @author Jérémy Derussé + */ +interface SessionFactoryInterface +{ + /** + * Creates a new instance of SessionInterface. + */ + public function createSession(): SessionInterface; +} pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy