2828use Sentry \SentrySdk ;
2929use Sentry \State \Scope ;
3030use Symfony \Component \Console \Input \ArgvInput ;
31- use Symfony \Component \Console \Input \ArrayInput ;
3231use Symfony \Component \Console \Input \InputInterface ;
3332
3433class EventHandler
@@ -572,7 +571,7 @@ protected function commandStartingHandler(CommandStarting $event)
572571 'artisan.command ' ,
573572 'Starting Artisan command: ' . $ event ->command ,
574573 [
575- 'input ' => $ this ->extractCommandInput ($ event ->input ),
574+ 'input ' => $ this ->extractConsoleCommandInput ($ event ->input ),
576575 ]
577576 ));
578577 }
@@ -593,21 +592,27 @@ protected function commandFinishedHandler(CommandFinished $event)
593592 'Finished Artisan command: ' . $ event ->command ,
594593 [
595594 'exit ' => $ event ->exitCode ,
596- 'input ' => $ this ->extractCommandInput ($ event ->input ),
595+ 'input ' => $ this ->extractConsoleCommandInput ($ event ->input ),
597596 ]
598597 ));
599598 }
600599
601- Integration::configureScope (static function (Scope $ scope ): void {
602- $ scope ->setTag ('command ' , '' );
603- });
604-
605600 // Flush any and all events that were possibly generated by the command
606601 Integration::flushEvents ();
602+
603+ Integration::configureScope (static function (Scope $ scope ): void {
604+ $ scope ->removeTag ('command ' );
605+ });
607606 }
608607
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
611616 {
612617 if ($ input instanceof ArgvInput) {
613618 return (string )$ input ;
0 commit comments