Replies: 1 comment
-
Look at https://github.com/CuyZ/Valinor or https://github.com/shipmonk-rnd/input-mapper 😊 |
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
-
Is there some library like
zod
in TypeScript that allows to:but for PHP + PHPStan?
The goal: I want to validate incoming associative array with some data using data schema and then use it type safely. Currently, I use Symfony validator to validate the data. But then I have to add a giant
assert
s list to make PHPStan happy.Example code:
This is just a small piece to demonstrate the problem. Real data structures have dozens of fields, and some of them contain nested schemas.
Beta Was this translation helpful? Give feedback.
All reactions