Skip to content

Commit 1f5f0b5

Browse files
committed
Fix console listener nullable command name
1 parent 62d5c9d commit 1f5f0b5

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/EventListener/ConsoleListener.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,14 @@ public function onConsoleCommand(ConsoleCommandEvent $event): void
3333
{
3434
$command = $event->getCommand();
3535

36+
$commandName = null;
37+
if ($command) {
38+
$commandName = $command->getName();
39+
}
40+
3641
SentryBundle::getCurrentHub()
37-
->configureScope(function (Scope $scope) use ($command): void {
38-
$scope->setTag('command', $command ? $command->getName() : 'N/A');
42+
->configureScope(static function (Scope $scope) use ($commandName): void {
43+
$scope->setTag('command', $commandName ?? 'N/A');
3944
});
4045
}
4146
}

0 commit comments

Comments
 (0)