fix: cant auto complete method chaining#1446
Conversation
mfn
left a comment
There was a problem hiding this comment.
Hi,
cant auto complete method chaining
I find the description a bit lacking TBH. Thanks for the screenshots, at least helps a bit but…
The foreach block you added is more or less the same as the above it? The difference being the static?

I've a feeling this will make one case work and break another or generate misleading autocomplete in other cases.
Can someone else chime in here maybe?
Maybe the PR should also get a rebase against current master and I bet many test with snapshots will fail, when I'm reading the change right -> this should be adapte too.
|
@mfn yup, The difference being the static, because |
|
The issues I see:
The PR description talks about the custom scopes, but the change "changes everything else too". So maybe the PR isn't well scoped code-wise and should only target your custom scope issue? |
|
@mfn I'm sorry I was a little confused in the previous explanation, I'll explain again I define scopeActive in the User model Perhaps the best way is to remove static in the ide-helper |
But this is a double edged sword: some only work for static, other for both, some only dynamic probably. I don't see how we can do this in the current form without causing collateral issues. |
Because all the @anotations that ide-helper creates for the model are scope and where, they certainly work in both static and non-static forms. and laravel also recommends using the form So I think changing |
Please re-read #1446 (comment) , in the current form the PR creates issues with existing projects. |
5fdd7dd to
d2f1941
Compare
d2f1941 to
46b4c71
Compare
|
@mfn Please help me check again I've fixed it, non-static is now only applied to function If anything is not right, please let me know |
|
Can you please also run the test suite so we see the changes? |
|
@barryvdh It not work for me, whereName is still static |
|
WhereName is supposed to be static |
|
@barryvdh I know, but I think WhereName should support both static and non static. Example User::whereName()->get()
User::whereEmail()->whereName()->get() |
|
Hmm I could generate it like this; But that is a bit duplicated if I have to do that for all. Does above work for VSCode? |
|
Laravel Idea does the following when generating model helper files, I don't know if it's helpful in this case: Which then allows to use both: |



Summary
Type of change
Checklist
composer fix-styleBefore:
After: