Skip to content

Conversation

@adzchappers
Copy link

VSCode does not recognise some functions in a FormRequest (e.g. $this->has('some-var')), adding /** @mixin \Illuminate\Http\Request */ to the request.stub means that all FormRequests generated from php artisan make:request will have all auto completion and function recognition working correctly in VSCode.

Before
image

After
image

@shaedrich
Copy link
Contributor

There must be something wrong with your intelephense setup. As you can clearly see, FormRequest directly extends Request, which makes @mixin superfluous:

class FormRequest extends Request implements ValidatesWhenResolved

@adzchappers
Copy link
Author

I thought that too, but have seen this now on multiple different computers, both mac and windows based. This resolves it on both.

@shaedrich
Copy link
Contributor

That would mean, you have to put @mixin above every class no matter whether it extends from the very class you mark it to be a mixin of or not.

If it fixes this for you, great. But this is certainly not a bug with the framework. And even if it is, it's not a fix. If anything, it's a workaround.

@adzchappers
Copy link
Author

It's only happening on FormRequests which is why i thought it was very strange 🤷🏻

@shaedrich
Copy link
Contributor

Yeah, that might be so, but your supposed fix doesn't get to the bottom of this strangeness. It doesn't fix your problem. You are confusing correlation with causality here. I don't know what VSCode does to pick up the link between the two when you add @mixin but outside of VSCode this change makes zero chance and therefore shouldn't be made part of the framework because—no offense—some people have—and we've all been there—trouble with their IDE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants