-
-
Notifications
You must be signed in to change notification settings - Fork 96
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
laravel-ide-helper broken with laravel 11 #2959
Comments
It seems the template type |
Latest Intelephense versionLaravel 11Yes I’m using that package and generating the model docs.Il giorno 24 lug 2024, alle ore 23:45, Ben Mewburn ***@***.***> ha scritto:
It seems the template type TModel is not resolving to the actual type. To understand why some more context is needed.
What version of intelephense is this?
What version of Laravel?
Are you using https://github.com/barryvdh/laravel-ide-helper? If so, are you generating model docs?
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Latest intelephense version as in the pre-release (1.11) ? Or 1.10.4? When generating model docs is it to a separate file or the actual model file? |
Could be related to barryvdh/laravel-ide-helper#1572, laravel/framework#51851 |
I'm sorry I didn't specify...latest stable v1.10.4. The models are generating inside the Model file. |
I don't know if it is related but I had a similar problem after upgrading some packages. Laravel was already updated to 11, so I think it works correctly with Laravel 11. The problem is that the more you install vendor packages, the more you are likely to exceed the maximum file size. To check if it you have the same problem, go to
I increased the limit in the settings and it now works as expected! |
Non this is not my case unfortunately. |
I have the same issue. Laravel version: 11.21 IDE helper generates doc comments for /**
*
*
* @mixin \Eloquent
* @mixin \Illuminate\Database\Eloquent\Builder
* @mixin \Illuminate\Database\Query\Builder
*/
abstract class Model ... And /**
* @template TModel of \Illuminate\Database\Eloquent\Model
* ...
*/
class Builder ... The main problem is that the correct type isn't being passed down to the /**
* @mixin \Illuminate\Database\Eloquent\Builder<\App\Models\MyModel>
*/
class MyModel ... Unfortunately, this didn’t work with Intelephense. However, I believe this could be a possible solution because it works with another php intelisense. |
@tlevi101 |
I do have premium, and everything else works with |
@tlevi101 I generated a helper file with laravel 11 and fixed it manually below (untested). Ideally the laravel-ide-helper maintainers will fix it. https://gist.github.com/bmewburn/0433032378015d3cfefae0baf872bcdd Even though laravel 11 broke ide_helper it did improve the builder types in laravel itself. You can call |
لقد قمت بإنشاء ملف مساعد باستخدام laravel 11 وقمت بإصلاحه يدويًا أدناه (لم يتم اختباره). من الناحية المثالية، سيقوم المشرفون على laravel-ide-helper بإصلاحه. https://gist.github.com/bmewburn/0433032378015d3cfefae0baf872bcdd |
This issue has been fixed by barryvdh/laravel-ide-helper#1591. |
Thanks @KentarouTakeda ! That fixed part of the problem but I think the file created with |
@bmewburn it will be fixed by barryvdh/laravel-ide-helper#1631 |
Describe the bug
Last versions of Intelephense are showing errors on model instances. See the screenshot.
With error
Expected type 'App\Models\Vehicle'. Found 'Illuminate\Database\Eloquent\TModel'.intelephense(P1006)
@var \Illuminate\Database\Eloquent\TModel $vehicle
and for $section this is the error
Expected type 'App\Models\Section'. Found 'Illuminate\Database\Eloquent\Builder|null'.intelephense(P1006)
@var \Illuminate\Database\Eloquent\Builder|null $section
The only way to solve it is to put @var annotations like these (and not convenient to be added everywhere)
/** @var Vehicle|null $vehicle **/ /** @var Section|null $section **/ VehicleService::startWithSection($vehicle, $section);
it doesn't seem a problem many people have, so is there any configuration that it's causing this?
Thanks
The text was updated successfully, but these errors were encountered: