src/Bus/Middleware/CommandValidationMiddleware.php
public function execute($command, callable $next)
    {
        $command_name = get_class($command);

        $this->logger->info("validating {$command_name}");

        $violation = $this->validator->validate($command);
        if ($violation->count() > 0) {
            $message = str_replace(
                "This value",
                ucfirst($violation->get(0)->getPropertyPath()),
                $violation->get(0)->getMessage()
            );
            $this->logger->error("{$command_name} : {$message}");
            throw new InvalidCommandException($message, Response::HTTP_BAD_REQUEST);
        }

        $this->logger->info("{$command_name} has passed validation");
        return $next($command);
    }
public function execute($command, callable $next)
    {
        $command_name = get_class($command);

        $this->logger->info("validating {$command_name}");

        $violation = $this->validator->validate($command);
        if ($violation->count() > 0) {
            $message = str_replace(
                "This value",
                ucfirst($violation->get(0)->getPropertyPath()),
                $violation->get(0)->getMessage()
            );
            $this->logger->error("{$command_name} : {$message}");
            throw new InvalidCommandException($message, Response::HTTP_BAD_REQUEST);
        }

        $this->logger->info("{$command_name} has passed validation");
        return $next($command);
    }
{@inheritdoc}