Replies: 1 comment
-
I use PHPStan array shapes to type /** @param array{id?: ?string} */
public function __invoke(null $_, array $args): ... Note the two Also, have you considered |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I was working on making a previously required ID optional for a specific mutation. When i adjusted everything, i wrote a test with NULL as ID but it obviously failed when the frontend omited the ID while sending it. Lighthouse andled everything well, but in my code it did break because i cant array access a key that does not exist...
If the $args passed to the resolver would be an object like a Request or Collection, this could be handled gracefully by simply returning null for a missing key... If the Interrest for such a solution exists, i would be willing to invest some time in to it.
Beta Was this translation helpful? Give feedback.
All reactions