laravel-ide-helper
laravel-ide-helper copied to clipboard
Removing extends from generated class breaks autocomplete
Versions:
- ide-helper Version: 2.11.0
- Laravel Version: 8.79.0
- PHP Version: 8.0
Description:
https://github.com/barryvdh/laravel-ide-helper/pull/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
Can you use --write
to write this to the model files directly? Or at least, can you test if it elevates the problem?
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.
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 I think this was introduced in #1268