GraphQL Codegen.
Examples:
For that graphql SDL schema you get that code.
Then you can implement auto-generated interfaces, and that will guarantee that you didn't miss anything. Furthemore generated interface is strongly typed (with php natives and PSALM/PHPStan annotations) - so, if you have psalm/phpstan you will have 100% type-safety.