BenMakesGames/PoppySeedPets

controllers should use bespoke request DTOs instead of the `Request` service

オープン

#18 opened on 2025/04/05

 (0 件のコメント) (0 件のリアクション) (0 人の担当者)PHP (6 件のフォーク)auto 404
good first issuetech debt

Repository metrics

Stars
 (14 個のスター)
PR merge metrics
 (PR metrics pending)

説明

Symfony added this feature a bit ago: https://symfony.com/blog/new-in-symfony-6-3-mapping-request-data-to-typed-objects

the LogInController uses it, but few other endpoints do. upgrade all controllers that handle requests to use them.

other notes:

  • if you find a controller that really feels like "nah, it should keep using Request", add a comment explaining why Request is being used instead of a request DTO
  • request DTOs must live in the same file as the controller that uses them
    • do not fall for the trap of "false sameness" - 99%+ of request DTOs have no business being shared between multiple endpoints

it's totally legit to upgrade just one endpoint or a small group of endpoints in a PR; this issue will be closed when no controllers remain which are using Request.

コントリビューターガイド