Skip to content

Commit 9caa2bf

Browse files
committed
[HttpKernel] remove all deprecated code from http kernel
1 parent 927b1b2 commit 9caa2bf

File tree

64 files changed

+355
-1162
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+355
-1162
lines changed

UPGRADE-5.0.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,8 @@ HttpKernel
252252
----------
253253

254254
* Removed `Client`, use `HttpKernelBrowser` instead
255-
* The `Kernel::getRootDir()` and the `kernel.root_dir` parameter have been removed
255+
* The `Kernel::getRootDir()` and the `kernel.root_dir` parameter
256+
have been removed, use `Kernel::getProjectDir()` and the `kernel.project_dir` instead
256257
* The `KernelInterface::getName()` and the `kernel.name` parameter have been removed
257258
* Removed the first and second constructor argument of `ConfigDataCollector`
258259
* Removed `ConfigDataCollector::getApplicationName()`
@@ -265,6 +266,7 @@ HttpKernel
265266
* Removed `GetResponseForExceptionEvent`, use `ExceptionEvent` instead
266267
* Removed `PostResponseEvent`, use `TerminateEvent` instead
267268
* Removed `TranslatorListener` in favor of `LocaleAwareListener`
269+
* Removed `SaveSessionListener` in favor of `AbstractSessionListener`
268270
* The `DebugHandlersListener` class has been made `final`
269271

270272
Intl

src/Symfony/Bridge/Monolog/Handler/ChromePhpHandler.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
use Monolog\Handler\ChromePHPHandler as BaseChromePhpHandler;
1515
use Symfony\Component\HttpFoundation\Response;
16-
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
16+
use Symfony\Component\HttpKernel\Event\ResponseEvent;
1717

1818
/**
1919
* ChromePhpHandler.
@@ -34,7 +34,7 @@ class ChromePhpHandler extends BaseChromePhpHandler
3434
/**
3535
* Adds the headers to the response once it's created.
3636
*/
37-
public function onKernelResponse(FilterResponseEvent $event)
37+
public function onKernelResponse(ResponseEvent $event)
3838
{
3939
if (!$event->isMasterRequest()) {
4040
return;

src/Symfony/Bridge/Monolog/Handler/FirePHPHandler.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
use Monolog\Handler\FirePHPHandler as BaseFirePHPHandler;
1515
use Symfony\Component\HttpFoundation\Response;
16-
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
16+
use Symfony\Component\HttpKernel\Event\ResponseEvent;
1717

1818
/**
1919
* FirePHPHandler.
@@ -34,7 +34,7 @@ class FirePHPHandler extends BaseFirePHPHandler
3434
/**
3535
* Adds the headers to the response once it's created.
3636
*/
37-
public function onKernelResponse(FilterResponseEvent $event)
37+
public function onKernelResponse(ResponseEvent $event)
3838
{
3939
if (!$event->isMasterRequest()) {
4040
return;

src/Symfony/Bridge/Monolog/Handler/SwiftMailerHandler.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
use Monolog\Handler\SwiftMailerHandler as BaseSwiftMailerHandler;
1515
use Symfony\Component\Console\Event\ConsoleTerminateEvent;
16-
use Symfony\Component\HttpKernel\Event\PostResponseEvent;
16+
use Symfony\Component\HttpKernel\Event\TerminateEvent;
1717

1818
/**
1919
* Extended SwiftMailerHandler that flushes mail queue if necessary.
@@ -36,7 +36,7 @@ public function setTransport(\Swift_Transport $transport)
3636
/**
3737
* After the kernel has been terminated we will always flush messages.
3838
*/
39-
public function onKernelTerminate(PostResponseEvent $event)
39+
public function onKernelTerminate(TerminateEvent $event)
4040
{
4141
$this->instantFlush = true;
4242
}

src/Symfony/Bridge/Monolog/Processor/RouteProcessor.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
1515
use Symfony\Component\HttpKernel\Event\FinishRequestEvent;
16-
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
16+
use Symfony\Component\HttpKernel\Event\RequestEvent;
1717
use Symfony\Component\HttpKernel\KernelEvents;
1818
use Symfony\Contracts\Service\ResetInterface;
1919

@@ -49,7 +49,7 @@ public function reset()
4949
$this->routeData = [];
5050
}
5151

52-
public function addRouteData(GetResponseEvent $event)
52+
public function addRouteData(RequestEvent $event)
5353
{
5454
if ($event->isMasterRequest()) {
5555
$this->reset();

src/Symfony/Bridge/Monolog/Processor/WebProcessor.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
use Monolog\Processor\WebProcessor as BaseWebProcessor;
1515
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
16-
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
16+
use Symfony\Component\HttpKernel\Event\ResponseEvent;
1717
use Symfony\Component\HttpKernel\KernelEvents;
1818

1919
/**
@@ -31,7 +31,7 @@ public function __construct(array $extraFields = null)
3131
parent::__construct([], $extraFields);
3232
}
3333

34-
public function onKernelRequest(GetResponseEvent $event)
34+
public function onKernelRequest(ResponseEvent $event)
3535
{
3636
if ($event->isMasterRequest()) {
3737
$this->serverData = $event->getRequest()->server->all();

src/Symfony/Bridge/Monolog/Tests/Processor/RouteProcessorTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Symfony\Component\HttpFoundation\ParameterBag;
1717
use Symfony\Component\HttpFoundation\Request;
1818
use Symfony\Component\HttpKernel\Event\FinishRequestEvent;
19-
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
19+
use Symfony\Component\HttpKernel\Event\RequestEvent;
2020

2121
class RouteProcessorTest extends TestCase
2222
{
@@ -122,9 +122,9 @@ public function testProcessorDoesNothingWhenNoRequest()
122122
$this->assertEquals(['extra' => []], $record);
123123
}
124124

125-
private function mockGetResponseEvent(Request $request): GetResponseEvent
125+
private function mockGetResponseEvent(Request $request): RequestEvent
126126
{
127-
$event = $this->getMockBuilder(GetResponseEvent::class)->disableOriginalConstructor()->getMock();
127+
$event = $this->getMockBuilder(RequestEvent::class)->disableOriginalConstructor()->getMock();
128128
$event->method('getRequest')->willReturn($request);
129129

130130
return $event;

src/Symfony/Bridge/Monolog/Tests/Processor/WebProcessorTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use PHPUnit\Framework\TestCase;
1616
use Symfony\Bridge\Monolog\Processor\WebProcessor;
1717
use Symfony\Component\HttpFoundation\Request;
18-
use Symfony\Component\HttpKernel\Event\RequestEvent;
18+
use Symfony\Component\HttpKernel\Event\ResponseEvent;
1919

2020
class WebProcessorTest extends TestCase
2121
{
@@ -88,7 +88,7 @@ private function createRequestEvent($additionalServerParameters = []): array
8888
$request->server->replace($server);
8989
$request->headers->replace($server);
9090

91-
$event = $this->getMockBuilder(RequestEvent::class)
91+
$event = $this->getMockBuilder(ResponseEvent::class)
9292
->disableOriginalConstructor()
9393
->getMock();
9494
$event->expects($this->any())

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@
8787

8888
<service id="file_locator" class="Symfony\Component\HttpKernel\Config\FileLocator">
8989
<argument type="service" id="kernel" />
90-
<argument>%kernel.root_dir%/Resources</argument>
90+
<argument>%kernel.project_dir%/Resources</argument>
9191
<argument type="collection">
92-
<argument>%kernel.root_dir%</argument>
92+
<argument>%kernel.project_dir%</argument>
9393
</argument>
9494
</service>
9595
<service id="Symfony\Component\HttpKernel\Config\FileLocator" alias="file_locator" />

src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ function ($path, $catalogue) use ($loadedMessages) {
176176
->willReturn([]);
177177

178178
$container = new Container();
179-
$container->setParameter('kernel.root_dir', $this->translationDir);
179+
$container->setParameter('kernel.project_dir', $this->translationDir);
180180

181181
$kernel
182182
->expects($this->any())

src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ function ($path, $catalogue) use ($loadedMessages) {
159159

160160
$kernel
161161
->expects($this->any())
162-
->method('getRootDir')
162+
->method('getProjectDir')
163163
->willReturn($this->translationDir);
164164

165165
$kernel
@@ -168,7 +168,7 @@ function ($path, $catalogue) use ($loadedMessages) {
168168
->willReturn([]);
169169

170170
$container = new Container();
171-
$container->setParameter('kernel.root_dir', $this->translationDir);
171+
$container->setParameter('kernel.project_dir', $this->translationDir);
172172
$kernel
173173
->expects($this->any())
174174
->method('getContainer')

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php

-1
Original file line numberDiff line numberDiff line change
@@ -1355,7 +1355,6 @@ protected function createContainer(array $data = [])
13551355
'kernel.debug' => false,
13561356
'kernel.environment' => 'test',
13571357
'kernel.name' => 'kernel',
1358-
'kernel.root_dir' => __DIR__,
13591358
'kernel.container_class' => 'testContainer',
13601359
'container.build_hash' => 'Abc1234',
13611360
'container.build_id' => hash('crc32', 'Abc123423456789'),

src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/ConcreteMicroKernel.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
2020
use Symfony\Component\Filesystem\Filesystem;
2121
use Symfony\Component\HttpFoundation\Response;
22-
use Symfony\Component\HttpKernel\Event\RequestEvent;
22+
use Symfony\Component\HttpKernel\Event\ExceptionEvent;
2323
use Symfony\Component\HttpKernel\Kernel;
2424
use Symfony\Component\HttpKernel\KernelEvents;
2525
use Symfony\Component\Routing\RouteCollectionBuilder;
@@ -30,7 +30,7 @@ class ConcreteMicroKernel extends Kernel implements EventSubscriberInterface
3030

3131
private $cacheDir;
3232

33-
public function onKernelException(RequestEvent $event)
33+
public function onKernelException(ExceptionEvent $event)
3434
{
3535
if ($event->getException() instanceof Danger) {
3636
$event->setResponse(Response::create('It\'s dangerous to go alone. Take this ⚔'));

src/Symfony/Bundle/FrameworkBundle/composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"symfony/config": "^4.4|^5.0",
2323
"symfony/dependency-injection": "^4.4|^5.0",
2424
"symfony/http-foundation": "^4.4|^5.0",
25-
"symfony/http-kernel": "^4.4|^5.0",
25+
"symfony/http-kernel": "^5.0",
2626
"symfony/polyfill-mbstring": "~1.0",
2727
"symfony/filesystem": "^4.4|^5.0",
2828
"symfony/finder": "^4.4|^5.0",

src/Symfony/Bundle/SecurityBundle/EventListener/FirewallListener.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use Symfony\Bundle\SecurityBundle\Security\FirewallMap;
1515
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
1616
use Symfony\Component\HttpKernel\Event\FinishRequestEvent;
17-
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
17+
use Symfony\Component\HttpKernel\Event\RequestEvent;
1818
use Symfony\Component\HttpKernel\KernelEvents;
1919
use Symfony\Component\Security\Http\Firewall;
2020
use Symfony\Component\Security\Http\FirewallMapInterface;
@@ -41,7 +41,7 @@ public function __construct(FirewallMapInterface $map, EventDispatcherInterface
4141
/**
4242
* @internal
4343
*/
44-
public function configureLogoutUrlGenerator(GetResponseEvent $event)
44+
public function configureLogoutUrlGenerator(RequestEvent $event)
4545
{
4646
if (!$event->isMasterRequest()) {
4747
return;

src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/AddSessionDomainConstraintPassTest.php

-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ private function createContainer($sessionStorageOptions)
125125
$container->setParameter('kernel.container_class', 'cc');
126126
$container->setParameter('kernel.debug', true);
127127
$container->setParameter('kernel.project_dir', __DIR__);
128-
$container->setParameter('kernel.root_dir', __DIR__);
129128
$container->setParameter('kernel.secret', __DIR__);
130129
if (null !== $sessionStorageOptions) {
131130
$container->setParameter('session.storage.options', $sessionStorageOptions);

src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/SecurityExtensionTest.php

-1
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,6 @@ public function testRememberMeCookieInheritFrameworkSessionCookie($config, $same
354354
$container->registerExtension(new FrameworkExtension());
355355
$container->setParameter('kernel.bundles_metadata', []);
356356
$container->setParameter('kernel.project_dir', __DIR__);
357-
$container->setParameter('kernel.root_dir', __DIR__);
358357
$container->setParameter('kernel.cache_dir', __DIR__);
359358

360359
$container->loadFromExtension('security', [

src/Symfony/Bundle/TwigBundle/Resources/config/console.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<argument>%kernel.bundles_metadata%</argument>
1414
<argument>%twig.default_path%</argument>
1515
<argument type="service" id="debug.file_link_formatter" on-invalid="null" />
16-
<argument>%kernel.root_dir%</argument>
16+
<argument>%kernel.project_dir%</argument>
1717
<tag name="console.command" command="debug:twig" />
1818
</service>
1919

src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php

-1
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,6 @@ private function createContainer(string $rootDir = __DIR__.'/Fixtures')
264264
{
265265
$container = new ContainerBuilder(new ParameterBag([
266266
'kernel.cache_dir' => __DIR__,
267-
'kernel.root_dir' => $rootDir,
268267
'kernel.project_dir' => __DIR__,
269268
'kernel.charset' => 'UTF-8',
270269
'kernel.debug' => false,

src/Symfony/Bundle/TwigBundle/composer.json

+20-19
Original file line numberDiff line numberDiff line change
@@ -16,33 +16,34 @@
1616
}
1717
],
1818
"require": {
19-
"php": "^7.2.9",
20-
"symfony/config": "^4.4|^5.0",
19+
"php": "^7.1.3",
20+
"symfony/config": "^4.2|^5.0",
2121
"symfony/twig-bridge": "^4.4|^5.0",
22-
"symfony/http-foundation": "^4.4|^5.0",
23-
"symfony/http-kernel": "^4.4|^5.0",
22+
"symfony/http-foundation": "^4.3|^5.0",
23+
"symfony/http-kernel": "^4.1|^5.0",
2424
"symfony/polyfill-ctype": "~1.8",
2525
"twig/twig": "~1.41|~2.10"
2626
},
2727
"require-dev": {
28-
"symfony/asset": "^4.4|^5.0",
29-
"symfony/stopwatch": "^4.4|^5.0",
30-
"symfony/dependency-injection": "^4.4|^5.0",
31-
"symfony/expression-language": "^4.4|^5.0",
32-
"symfony/finder": "^4.4|^5.0",
33-
"symfony/form": "^4.4|^5.0",
34-
"symfony/routing": "^4.4|^5.0",
35-
"symfony/translation": "^5.0",
36-
"symfony/yaml": "^4.4|^5.0",
37-
"symfony/framework-bundle": "^5.0",
38-
"symfony/web-link": "^4.4|^5.0",
28+
"symfony/asset": "^3.4|^4.0|^5.0",
29+
"symfony/stopwatch": "^3.4|^4.0|^5.0",
30+
"symfony/dependency-injection": "^4.2.5|^5.0",
31+
"symfony/expression-language": "^3.4|^4.0|^5.0",
32+
"symfony/finder": "^3.4|^4.0|^5.0",
33+
"symfony/form": "^3.4|^4.0|^5.0",
34+
"symfony/routing": "^3.4|^4.0|^5.0",
35+
"symfony/templating": "^3.4|^4.0|^5.0",
36+
"symfony/translation": "^4.2|^5.0",
37+
"symfony/yaml": "^3.4|^4.0|^5.0",
38+
"symfony/framework-bundle": "^4.3|^5.0",
39+
"symfony/web-link": "^3.4|^4.0|^5.0",
3940
"doctrine/annotations": "~1.0",
4041
"doctrine/cache": "~1.0"
4142
},
4243
"conflict": {
43-
"symfony/dependency-injection": "<4.4",
44-
"symfony/framework-bundle": "<5.0",
45-
"symfony/translation": "<5.0"
44+
"symfony/dependency-injection": "<4.1",
45+
"symfony/framework-bundle": "<4.3",
46+
"symfony/translation": "<4.2"
4647
},
4748
"autoload": {
4849
"psr-4": { "Symfony\\Bundle\\TwigBundle\\": "" },
@@ -53,7 +54,7 @@
5354
"minimum-stability": "dev",
5455
"extra": {
5556
"branch-alias": {
56-
"dev-master": "5.0-dev"
57+
"dev-master": "4.4-dev"
5758
}
5859
}
5960
}

src/Symfony/Bundle/WebProfilerBundle/EventListener/WebDebugToolbarListener.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Symfony\Component\HttpFoundation\Request;
1717
use Symfony\Component\HttpFoundation\Response;
1818
use Symfony\Component\HttpFoundation\Session\Flash\AutoExpireFlashBag;
19-
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
19+
use Symfony\Component\HttpKernel\Event\ResponseEvent;
2020
use Symfony\Component\HttpKernel\KernelEvents;
2121
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
2222
use Twig\Environment;
@@ -60,7 +60,7 @@ public function isEnabled()
6060
return self::DISABLED !== $this->mode;
6161
}
6262

63-
public function onKernelResponse(FilterResponseEvent $event)
63+
public function onKernelResponse(ResponseEvent $event)
6464
{
6565
$response = $event->getResponse();
6666
$request = $event->getRequest();

src/Symfony/Bundle/WebProfilerBundle/composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"require": {
1919
"php": "^7.2.9",
2020
"symfony/config": "^4.4|^5.0",
21-
"symfony/http-kernel": "^4.4|^5.0",
21+
"symfony/http-kernel": "^5.0",
2222
"symfony/routing": "^4.4|^5.0",
2323
"symfony/twig-bundle": "^4.4|^5.0",
2424
"symfony/var-dumper": "^4.4|^5.0",

src/Symfony/Component/HttpKernel/CHANGELOG.md

+15
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,21 @@ CHANGELOG
88
* removed `ConfigDataCollector::getApplicationName()`
99
* removed `ConfigDataCollector::getApplicationVersion()`
1010
* removed support for `Symfony\Component\Templating\EngineInterface` in `HIncludeFragmentRenderer`, use a `Twig\Environment` only
11+
* removed `Client`, use `HttpKernelBrowser` instead
12+
* removed the `Kernel::getRootDir()` and the `kernel.root_dir` parameter
13+
* removed the `KernelInterface::getName()` and the `kernel.name` parameter
14+
* removed the first and second constructor argument of `ConfigDataCollector`
15+
* removed `ConfigDataCollector::getApplicationName()`
16+
* removed `ConfigDataCollector::getApplicationVersion()`
17+
* removed `FilterControllerArgumentsEvent`, use `ControllerArgumentsEvent` instead
18+
* removed `FilterControllerEvent`, use `ControllerEvent` instead
19+
* removed `FilterResponseEvent`, use `ResponseEvent` instead
20+
* removed `GetResponseEvent`, use `RequestEvent` instead
21+
* removed `GetResponseForControllerResultEvent`, use `ViewEvent` instead
22+
* removed `GetResponseForExceptionEvent`, use `ExceptionEvent` instead
23+
* removed `PostResponseEvent`, use `TerminateEvent` instead
24+
* removed `TranslatorListener` in favor of `LocaleAwareListener`
25+
* removed `SaveSessionListener` in favor of `AbstractSessionListener`
1126

1227
4.3.0
1328
-----

0 commit comments

Comments
 (0)