Skip to content

[HttpKernel] Fix advertizing deprecations for *TestSessionListener #45615

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion UPGRADE-5.4.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ FrameworkBundle
HttpKernel
----------

* Deprecate `AbstractTestSessionListener::getSession` inject a session in the request instead
* Deprecate `AbstractTestSessionListener` and `TestSessionListener`, use `AbstractSessionListener` and `SessionListener` instead

HttpFoundation
--------------
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/HttpKernel/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ CHANGELOG
---

* Add the ability to enable the profiler using a request query parameter, body parameter or attribute
* Deprecate `AbstractTestSessionListener::getSession` inject a session in the request instead
* Deprecate `AbstractTestSessionListener` and `TestSessionListener`, use `AbstractSessionListener` and `SessionListener` instead
* Deprecate the `fileLinkFormat` parameter of `DebugHandlersListener`
* Add support for configuring log level, and status code by exception class
* Allow ignoring "kernel.reset" methods that don't exist with "on_invalid" attribute
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
use Symfony\Component\HttpKernel\Event\ResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents;

trigger_deprecation('symfony/http-kernel', '5.4', '"%s" is deprecated use "%s" instead.', AbstractTestSessionListener::class, AbstractSessionListener::class);

/**
* TestSessionListener.
*
Expand All @@ -29,7 +31,7 @@
*
* @internal
*
* @deprecated the TestSessionListener use the default SessionListener instead
* @deprecated since Symfony 5.4, use AbstractSessionListener instead
*/
abstract class AbstractTestSessionListener implements EventSubscriberInterface
{
Expand All @@ -39,8 +41,6 @@ abstract class AbstractTestSessionListener implements EventSubscriberInterface
public function __construct(array $sessionOptions = [])
{
$this->sessionOptions = $sessionOptions;

trigger_deprecation('symfony/http-kernel', '5.4', 'The %s is deprecated use the %s instead.', __CLASS__, AbstractSessionListener::class);
}

public function onKernelRequest(RequestEvent $event)
Expand Down Expand Up @@ -114,8 +114,6 @@ public static function getSubscribedEvents(): array
/**
* Gets the session object.
*
* @deprecated since Symfony 5.4, will be removed in 6.0.
*
* @return SessionInterface|null
*/
abstract protected function getSession();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@
use Psr\Container\ContainerInterface;
use Symfony\Component\HttpFoundation\Session\SessionInterface;

trigger_deprecation('symfony/http-kernel', '5.4', '"%s" is deprecated, use "%s" instead.', TestSessionListener::class, SessionListener::class);

/**
* Sets the session in the request.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @final
*
* @deprecated the TestSessionListener use the default SessionListener instead
* @deprecated since Symfony 5.4, use SessionListener instead
*/
class TestSessionListener extends AbstractTestSessionListener
{
Expand All @@ -33,13 +35,8 @@ public function __construct(ContainerInterface $container, array $sessionOptions
parent::__construct($sessionOptions);
}

/**
* @deprecated since Symfony 5.4, will be removed in 6.0.
*/
protected function getSession(): ?SessionInterface
{
trigger_deprecation('symfony/http-kernel', '5.4', '"%s" is deprecated and will be removed in 6.0, inject a session in the request instead.', __METHOD__);

if ($this->container->has('session')) {
return $this->container->get('session');
}
Expand Down