File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ public function __construct(
4242 private readonly Profiler $ profiler ,
4343 private readonly RequestStack $ requestStack ,
4444 private readonly Stopwatch $ stopwatch ,
45+ private readonly bool $ cliMode ,
4546 private readonly UrlGeneratorInterface $ urlGenerator ,
4647 ) {
4748 $ this ->profiles = new \SplObjectStorage ();
@@ -59,6 +60,10 @@ public static function getSubscribedEvents(): array
5960
6061 public function initialize (ConsoleCommandEvent $ event ): void
6162 {
63+ if (!$ this ->cliMode ) {
64+ return ;
65+ }
66+
6267 $ input = $ event ->getInput ();
6368 if (!$ input ->hasOption ('profile ' ) || !$ input ->getOption ('profile ' )) {
6469 $ this ->profiler ->disable ();
@@ -78,12 +83,16 @@ public function initialize(ConsoleCommandEvent $event): void
7883
7984 public function catch (ConsoleErrorEvent $ event ): void
8085 {
86+ if (!$ this ->cliMode ) {
87+ return ;
88+ }
89+
8190 $ this ->error = $ event ->getError ();
8291 }
8392
8493 public function profile (ConsoleTerminateEvent $ event ): void
8594 {
86- if (!$ this ->profiler ->isEnabled ()) {
95+ if (!$ this ->cliMode || ! $ this -> profiler ->isEnabled ()) {
8796 return ;
8897 }
8998
Original file line number Diff line number Diff line change 4343 service ('profiler ' ),
4444 service ('.virtual_request_stack ' ),
4545 service ('debug.stopwatch ' ),
46+ param ('kernel.runtime_mode.cli ' ),
4647 service ('router ' ),
4748 ])
4849 ->tag ('kernel.event_subscriber ' )
You can’t perform that action at this time.
0 commit comments