Skip to content

Removing extends from generated class breaks autocomplete #1299

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

Closed
Jefemy opened this issue Jan 17, 2022 · 4 comments · Fixed by #1352
Closed

Removing extends from generated class breaks autocomplete #1299

Jefemy opened this issue Jan 17, 2022 · 4 comments · Fixed by #1352
Labels

Comments

@Jefemy
Copy link
Contributor

Jefemy commented Jan 17, 2022

Versions:

  • ide-helper Version: 2.11.0
  • Laravel Version: 8.79.0
  • PHP Version: 8.0

Description:

#1268 changed mixin mode to not add an extends to the generated class. This breaks the autocomplete for functions like Model->find() as my classes no longer extend \Eloquent

Steps To Reproduce:

  • Run ide-helper:models -M
  • Try to use the find() function on any model and see that the return type is listed as mixed instead of the proper class
@Jefemy Jefemy added the bug label Jan 17, 2022
@mfn
Copy link
Collaborator

mfn commented Jan 18, 2022

Can you use --write to write this to the model files directly? Or at least, can you test if it elevates the problem?

@Jefemy
Copy link
Contributor Author

Jefemy commented Jan 20, 2022

After running that command it appears to have fixed it even after reverting back to just the -M command. Must have just been an issue with my IntelliSense extension.

@Jefemy Jefemy closed this as completed Jan 20, 2022
@Jefemy
Copy link
Contributor Author

Jefemy commented Jan 28, 2022

Actually I do think this is an issue. After looking into it some more I realized my output doesn't include the @mixin \Eloquent that the test case includes here.

This appears to be caused by the line here where it ignores adding the tag if there is a mixin present in the Model class, which there always will be after the first run since the command writes a mixin.

The commit adding it mentions its for preventing duplicate mixin tags but shouldn't it only be checking for tags with the \Eloquent class?

@Jefemy Jefemy reopened this Jan 28, 2022
@edcoreweb
Copy link
Contributor

@Jefemy I think this was introduced in #1268

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants