addArgument('email', InputArgument::REQUIRED, 'Recipient email address') ->addArgument('name', InputArgument::REQUIRED, 'Recipient display name') ; } protected function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); $envelope = $this->bus->dispatch(new WelcomeEmail( $input->getArgument('email'), $input->getArgument('name'), )); $handled = $envelope->last(HandledStamp::class); if (!$handled instanceof HandledStamp) { $io->error('The WelcomeEmail message was dispatched, but no handler returned a result.'); return Command::FAILURE; } $io->success($handled->getResult()); return Command::SUCCESS; } }