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

Skip to content

Commit 1358007

Browse files
[HttpKernel] Dont implement ServiceSubscriberInterface on *SessionListener
1 parent 05d15cf commit 1358007

File tree

4 files changed

+18
-30
lines changed

4 files changed

+18
-30
lines changed

src/Symfony/Bundle/FrameworkBundle/Resources/config/session.xml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,14 @@
5353

5454
<service id="session_listener" class="Symfony\Component\HttpKernel\EventListener\SessionListener">
5555
<tag name="kernel.event_subscriber" />
56-
<tag name="container.service_subscriber" id="session" />
57-
<argument type="service" id="container" />
56+
<argument type="service">
57+
<service class="Symfony\Component\DependencyInjection\ServiceLocator">
58+
<tag name="container.service_locator" />
59+
<argument type="collection">
60+
<argument key="session" type="service" id="session" on-invalid="ignore" />
61+
</argument>
62+
</service>
63+
</argument>
5864
</service>
5965

6066
<service id="session.save_listener" class="Symfony\Component\HttpKernel\EventListener\SaveSessionListener">

src/Symfony/Bundle/FrameworkBundle/Resources/config/test.xml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,14 @@
2222

2323
<service id="test.session.listener" class="Symfony\Component\HttpKernel\EventListener\TestSessionListener">
2424
<tag name="kernel.event_subscriber" />
25-
<tag name="container.service_subscriber" id="session" />
26-
<argument type="service" id="container" />
25+
<argument type="service">
26+
<service class="Symfony\Component\DependencyInjection\ServiceLocator">
27+
<tag name="container.service_locator" />
28+
<argument type="collection">
29+
<argument key="session" type="service" id="session" on-invalid="ignore" />
30+
</argument>
31+
</service>
32+
</argument>
2733
</service>
2834
</services>
2935
</container>

src/Symfony/Component/HttpKernel/EventListener/SessionListener.php

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
namespace Symfony\Component\HttpKernel\EventListener;
1313

1414
use Psr\Container\ContainerInterface;
15-
use Symfony\Component\DependencyInjection\ServiceSubscriberInterface;
16-
use Symfony\Component\HttpFoundation\Session\SessionInterface;
1715

1816
/**
1917
* Sets the session in the request.
@@ -22,7 +20,7 @@
2220
*
2321
* @final since version 3.3
2422
*/
25-
class SessionListener extends AbstractSessionListener implements ServiceSubscriberInterface
23+
class SessionListener extends AbstractSessionListener
2624
{
2725
private $container;
2826

@@ -39,14 +37,4 @@ protected function getSession()
3937

4038
return $this->container->get('session');
4139
}
42-
43-
/**
44-
* {@inheritdoc}
45-
*/
46-
public static function getSubscribedServices()
47-
{
48-
return array(
49-
'session' => '?'.SessionInterface::class,
50-
);
51-
}
5240
}

src/Symfony/Component/HttpKernel/EventListener/TestSessionListener.php

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
namespace Symfony\Component\HttpKernel\EventListener;
1313

1414
use Psr\Container\ContainerInterface;
15-
use Symfony\Component\DependencyInjection\ServiceSubscriberInterface;
16-
use Symfony\Component\HttpFoundation\Session\SessionInterface;
1715

1816
/**
1917
* Sets the session in the request.
@@ -22,7 +20,7 @@
2220
*
2321
* @final since version 3.3
2422
*/
25-
class TestSessionListener extends AbstractTestSessionListener implements ServiceSubscriberInterface
23+
class TestSessionListener extends AbstractTestSessionListener
2624
{
2725
private $container;
2826

@@ -39,14 +37,4 @@ protected function getSession()
3937

4038
return $this->container->get('session');
4139
}
42-
43-
/**
44-
* {@inheritdoc}
45-
*/
46-
public static function getSubscribedServices()
47-
{
48-
return array(
49-
'session' => '?'.SessionInterface::class,
50-
);
51-
}
5240
}

0 commit comments

Comments
 (0)