Skip to content

Commit

Permalink
chore: fixing command name resolution without attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
cdaguerre committed Jul 1, 2024
1 parent fc9b5e2 commit 73670d8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Tracing/Sampling/Voter/CommandVoter.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ class CommandVoter extends AbstractVoter implements CommandVoterInterface
*/
protected function getOperationNameFromEvent(object $event): string
{
return $event->getCommand()?->getDefaultName() ?: 'unknown-command';
if (!$command = $event->getCommand()) {
return 'unknown-command';
}

return $command->getDefaultName() ?: ($command->getName() ?: 'unknown-command');
}
}

0 comments on commit 73670d8

Please sign in to comment.