From 73670d835e9873061e2f840685e338ec17a6592e Mon Sep 17 00:00:00 2001 From: Christian Daguerre Date: Mon, 1 Jul 2024 09:17:24 +0200 Subject: [PATCH] chore: fixing command name resolution without attributes --- src/Tracing/Sampling/Voter/CommandVoter.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Tracing/Sampling/Voter/CommandVoter.php b/src/Tracing/Sampling/Voter/CommandVoter.php index c389131..b85dd84 100644 --- a/src/Tracing/Sampling/Voter/CommandVoter.php +++ b/src/Tracing/Sampling/Voter/CommandVoter.php @@ -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'); } }