Skip to content

Can we have an additional option to declare response in doc-block? #598

Answered by romalytvynenko
mikield asked this question in Q&A
Discussion options

You must be logged in to vote

@mikield I planned to move to using attributes for responses instead of PHPDoc annotations.

Types will be passed to the attribute as a string:

#[Response(body: 'AnonymousResourceCollection<TodoItemResource>', status: 200)]
public function index()
{
    // ...
}

I planned to do such types parsing strict: in case the class is not imported, Scramble will throw the error.

This, however, still does not solve the issue you're raising. I quickly scanned through the PhpStorm meta documentation, but have not found how to make PhpStorm recognized strings passed to $body parameter as class names. If you can look at that, I'd appreciate it!

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@m4tthumphrey
Comment options

Answer selected by mikield
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants