postId <= 0) { throw new BadRequestException('postId must be positive'); } if ($request->userId <= 0) { throw new BadRequestException('userId must be positive'); } $body = $request->body === null ? '' : trim($request->body); if ($body === '') { throw new BadRequestException('body is required'); } if ($this->postRepo->find($request->postId) === null) { throw new DomainException('post not found'); } return $this->commentRepo->create(new CreateCommentDto( postId: $request->postId, userId: $request->userId, body: $body, createdAt: $this->clock->now(), )); } }