28
28
use Sentry \SentrySdk ;
29
29
use Sentry \State \Scope ;
30
30
use Symfony \Component \Console \Input \ArgvInput ;
31
- use Symfony \Component \Console \Input \ArrayInput ;
32
31
use Symfony \Component \Console \Input \InputInterface ;
33
32
34
33
class EventHandler
@@ -572,7 +571,7 @@ protected function commandStartingHandler(CommandStarting $event)
572
571
'artisan.command ' ,
573
572
'Starting Artisan command: ' . $ event ->command ,
574
573
[
575
- 'input ' => $ this ->extractCommandInput ($ event ->input ),
574
+ 'input ' => $ this ->extractConsoleCommandInput ($ event ->input ),
576
575
]
577
576
));
578
577
}
@@ -593,21 +592,27 @@ protected function commandFinishedHandler(CommandFinished $event)
593
592
'Finished Artisan command: ' . $ event ->command ,
594
593
[
595
594
'exit ' => $ event ->exitCode ,
596
- 'input ' => $ this ->extractCommandInput ($ event ->input ),
595
+ 'input ' => $ this ->extractConsoleCommandInput ($ event ->input ),
597
596
]
598
597
));
599
598
}
600
599
601
- Integration::configureScope (static function (Scope $ scope ): void {
602
- $ scope ->setTag ('command ' , '' );
603
- });
604
-
605
600
// Flush any and all events that were possibly generated by the command
606
601
Integration::flushEvents ();
602
+
603
+ Integration::configureScope (static function (Scope $ scope ): void {
604
+ $ scope ->removeTag ('command ' );
605
+ });
607
606
}
608
607
609
- /** @return string|null */
610
- private function extractCommandInput (InputInterface $ input )
608
+ /**
609
+ * Extract the command input arguments if possible.
610
+ *
611
+ * @param \Symfony\Component\Console\Input\InputInterface|null $input
612
+ *
613
+ * @return string|null
614
+ */
615
+ private function extractConsoleCommandInput (?InputInterface $ input ): ?string
611
616
{
612
617
if ($ input instanceof ArgvInput) {
613
618
return (string )$ input ;
0 commit comments