-
-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce Form Template to improve inference for processed payloads #248
Conversation
Signed-off-by: George Steel <[email protected]>
Signed-off-by: George Steel <[email protected]>
Signed-off-by: George Steel <[email protected]>
Signed-off-by: George Steel <[email protected]>
Psalm 5.16 doesn't fix the new |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The overall patch looks very good to me.
My only worry is that if we don't fix the bugs/mess on PSalm here, the users could be flooded with invalid errors as well.
@Ocramius do you know how to get PSalm working, or anyone we could ask for help?
Ok, I don't actually think that psalm likes I've updated the Static Analysis test case to illustrate template preservation using fluid return types, but not for all possible methods. Also, I thought that adding an interface method might be a BC break? Happy to revert that if is. |
…ited templates Signed-off-by: George Steel <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$ docker run --rm -v `pwd`:/app nyholm/roave-bc-check
[BC] ADDED: Method getValidatedPayload() was added to interface Laminas\Form\FormInterface
1 backwards-incompatible changes detected
I always thought it wasn't, but apparently it is a BC Break so yes please, revert it
Signed-off-by: George Steel <[email protected]>
Signed-off-by: George Steel <[email protected]>
@Slamdunk I'd like to try and keep this patch alive because the additional inference provided to consumers would be really useful for a project I'm working on 😁 |
As long as you give me a reasonable guarantee that users' PSalm runs won't explode with unresolvable errors after this patch, I'm totally ok with this 👍 |
…m the baseline. Signed-off-by: George Steel <[email protected]>
Signed-off-by: George Steel <[email protected]>
Signed-off-by: George Steel <[email protected]>
To verify that these psalm issues don't crop up for inheritors of Thanks @Slamdunk |
Worth releasing: triggered a release |
Description
Introduce Form Template to improve inference for processed payloads…
This patch should allow users to provide templates for form classes with full inference of the resulting valid payload.
Added an interface method, which we could probably revert considering that
Form::getData()
has decent inference if you explicitly pass a flag, due to the conditional return on the interface.There are some weird new issues around inheritance and fluent return types which I'm leaving here for now because I have no idea how to fix them, or why they were introduced by these changes. Maybe they are fixed in 5.16, so I'll update there…
Closes #238