Skip to content

Add generic templates for DataResponse and JSONResponse - #36355

Closed
provokateurin wants to merge 1 commit into
masterfrom
feature/generic-response-templates
Closed

Add generic templates for DataResponse and JSONResponse#36355
provokateurin wants to merge 1 commit into
masterfrom
feature/generic-response-templates

Conversation

@provokateurin

Copy link
Copy Markdown
Member

Summary

Add templates to indicate generic type. Not required, but very useful for OpenAPI.

Checklist

Signed-off-by: jld3103 <jld3103yt@gmail.com>
@provokateurin
provokateurinforce-pushed the feature/generic-response-templates branch from a56f235 to 9eff3c5CompareFebruary 1, 2023 07:57
@blizzzblizzz mentioned this pull request Feb 1, 2023
@come-nc

Copy link
Copy Markdown
Contributor

This adds a new constraints that one cannot use setData with another type than what was used in the constructor. No idea if this is a problem or not.

/**
* response data
* @var array|object
* @var T

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this weakens the type. before it was an array or object. now it can be anything

@provokateurin
provokateurin marked this pull request as draft February 3, 2023 09:11
@provokateurin

Copy link
Copy Markdown
MemberAuthor

Waiting on a solution for #36513 before continuing since this change might not be needed after all.

@provokateurin

Copy link
Copy Markdown
MemberAuthor

I just realized this isn't possible, since psalm will complain about missing template types in every place that isn't updated.

@skjnldsv
skjnldsv deleted the feature/generic-response-templates branch March 14, 2024 07:48
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2. developingWork in progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@provokateurin@come-nc@ChristophWurst@szaimen