Skip to content

Commit 06721ab

Browse files
[HttpKernel] Fix advertizing deprecations for *TestSessionListener
1 parent 64d15cd commit 06721ab

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ CHANGELOG
55
---
66

77
* Add the ability to enable the profiler using a request query parameter, body parameter or attribute
8-
* Deprecate `AbstractTestSessionListener::getSession` inject a session in the request instead
8+
* Deprecate `AbstractTestSessionListener` and `TestSessionListener`, use `AbstractSessionListener` and `SessionListener` instead
99
* Deprecate the `fileLinkFormat` parameter of `DebugHandlersListener`
1010
* Add support for configuring log level, and status code by exception class
1111
* Allow ignoring "kernel.reset" methods that don't exist with "on_invalid" attribute

EventListener/AbstractTestSessionListener.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
use Symfony\Component\HttpKernel\Event\ResponseEvent;
2020
use Symfony\Component\HttpKernel\KernelEvents;
2121

22+
trigger_deprecation('symfony/http-kernel', '5.4', '"%s" is deprecated use "%s" instead.', AbstractTestSessionListener::class, AbstractSessionListener::class);
23+
2224
/**
2325
* TestSessionListener.
2426
*
@@ -29,7 +31,7 @@
2931
*
3032
* @internal
3133
*
32-
* @deprecated the TestSessionListener use the default SessionListener instead
34+
* @deprecated since Symfony 5.4, use AbstractSessionListener instead
3335
*/
3436
abstract class AbstractTestSessionListener implements EventSubscriberInterface
3537
{
@@ -39,8 +41,6 @@ abstract class AbstractTestSessionListener implements EventSubscriberInterface
3941
public function __construct(array $sessionOptions = [])
4042
{
4143
$this->sessionOptions = $sessionOptions;
42-
43-
trigger_deprecation('symfony/http-kernel', '5.4', 'The %s is deprecated use the %s instead.', __CLASS__, AbstractSessionListener::class);
4444
}
4545

4646
public function onKernelRequest(RequestEvent $event)
@@ -114,8 +114,6 @@ public static function getSubscribedEvents(): array
114114
/**
115115
* Gets the session object.
116116
*
117-
* @deprecated since Symfony 5.4, will be removed in 6.0.
118-
*
119117
* @return SessionInterface|null
120118
*/
121119
abstract protected function getSession();

EventListener/TestSessionListener.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,16 @@
1414
use Psr\Container\ContainerInterface;
1515
use Symfony\Component\HttpFoundation\Session\SessionInterface;
1616

17+
trigger_deprecation('symfony/http-kernel', '5.4', '"%s" is deprecated, use "%s" instead.', TestSessionListener::class, SessionListener::class);
18+
1719
/**
1820
* Sets the session in the request.
1921
*
2022
* @author Fabien Potencier <fabien@symfony.com>
2123
*
2224
* @final
2325
*
24-
* @deprecated the TestSessionListener use the default SessionListener instead
26+
* @deprecated since Symfony 5.4, use SessionListener instead
2527
*/
2628
class TestSessionListener extends AbstractTestSessionListener
2729
{
@@ -33,13 +35,8 @@ public function __construct(ContainerInterface $container, array $sessionOptions
3335
parent::__construct($sessionOptions);
3436
}
3537

36-
/**
37-
* @deprecated since Symfony 5.4, will be removed in 6.0.
38-
*/
3938
protected function getSession(): ?SessionInterface
4039
{
41-
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__);
42-
4340
if ($this->container->has('session')) {
4441
return $this->container->get('session');
4542
}

0 commit comments

Comments
 (0)