File tree Expand file tree Collapse file tree 1 file changed +10
-15
lines changed Expand file tree Collapse file tree 1 file changed +10
-15
lines changed Original file line number Diff line number Diff line change @@ -639,32 +639,27 @@ to remove the ``kernel.reset`` tag from some services in your test environment::
639
639
// src/Kernel.php
640
640
namespace App;
641
641
642
- use App\DependencyInjection\Compiler\CustomPass;
643
642
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
643
+ use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
644
644
use Symfony\Component\DependencyInjection\ContainerBuilder;
645
645
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
646
646
647
- class Kernel extends BaseKernel
647
+ class Kernel extends BaseKernel implements CompilerPassInterface
648
648
{
649
649
use MicroKernelTrait;
650
650
651
651
// ...
652
652
653
- protected function build (ContainerBuilder $container): void
653
+ protected function process (ContainerBuilder $container): void
654
654
{
655
655
if ('test' === $this->environment) {
656
- $container->addCompilerPass(new class() implements CompilerPassInterface {
657
- public function process(ContainerBuilder $container): void
658
- {
659
- // prevents the security token to be cleared
660
- $container->getDefinition('security.token_storage')->clearTag('kernel.reset');
661
-
662
- // prevents Doctrine entities to be detached
663
- $container->getDefinition('doctrine')->clearTag('kernel.reset');
664
-
665
- // ...
666
- }
667
- });
656
+ // prevents the security token to be cleared
657
+ $container->getDefinition('security.token_storage')->clearTag('kernel.reset');
658
+
659
+ // prevents Doctrine entities to be detached
660
+ $container->getDefinition('doctrine')->clearTag('kernel.reset');
661
+
662
+ // ...
668
663
}
669
664
}
670
665
}
You can’t perform that action at this time.
0 commit comments