Skip to content
This repository was archived by the owner on Jun 25, 2025. It is now read-only.

Commit 016637b

Browse files
committed
Turning Kernel as compilerpass
1 parent 72c0bf8 commit 016637b

File tree

3 files changed

+18
-42
lines changed

3 files changed

+18
-42
lines changed

AsyncKernel.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@
1616
namespace Symfony\Component\HttpKernel;
1717

1818
use React\Promise\PromiseInterface;
19+
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
20+
use Symfony\Component\DependencyInjection\ContainerBuilder;
1921
use Symfony\Component\HttpFoundation\Request;
2022
use Symfony\Component\HttpKernel\Exception\AsyncHttpKernelNeededException;
2123

2224
/**
2325
* Class AsyncKernel.
2426
*/
25-
abstract class AsyncKernel extends Kernel
27+
abstract class AsyncKernel extends Kernel implements CompilerPassInterface
2628
{
2729
/**
2830
* Handles a Request to convert it to a Response.
@@ -57,4 +59,18 @@ public function handleAsync(
5759
$catch
5860
);
5961
}
62+
63+
/**
64+
* You can modify the container here before it is dumped to PHP code.
65+
*/
66+
public function process(ContainerBuilder $container)
67+
{
68+
$container
69+
->getDefinition('event_dispatcher')
70+
->setClass(AsyncEventDispatcher::class);
71+
72+
$container
73+
->getDefinition('http_kernel')
74+
->setClass(AsyncHttpKernel::class);
75+
}
6076
}

CompilerPass/AsyncHttpKernelCompilerPass.php

Lines changed: 0 additions & 41 deletions
This file was deleted.

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"php": ">=7.1",
1313

1414
"symfony/http-kernel": "^4.0",
15+
"symfony/dependency-injection": "^4.0",
1516
"react/promise": "*"
1617
},
1718
"require-dev": {

0 commit comments

Comments
 (0)