laravel-ide-helper
laravel-ide-helper copied to clipboard
Non-static method 'where'... after update Laravel and Ide-helper
- ide-helper Version: 2.9.1
- Laravel Version: 8.33.1
- PHP Version: 8.0
Hi, today after updated Laravel from 8.31.0 to 8.33.1 and Ide-helper from 2.9.0 to 2.9.1 (by composer update) and running all commands (eloquent, generate, meta and models --write-mixin) i'm getting error
Non-static method 'where' should not be called statically, but the class has the '__magic' method.
for
User::where('email', $email)->first()
Can you provide a repository for easily reproducing this? and can you provide the exact command you used there?
Ideally something like:
-
composer create-project laravel/laravel laravel-ide-helper-issue-1191
- commit
- make you changes
- commit
- push and show it here
Ok. I created fresh install (couple of times to check it) https://github.com/morawcik/test-laravel-ide-helper and it seams that sth with ide-generate:eloquent. My steps:
- run
composer create-project laravel/laravel laravel-ide-helper-issue-1191
- create database/database.sqlite file and update .env for this
- add
User::where('email', '[email protected]')->first();
to default route in routes/web.php - install laravel ide-helper
- run
php artisan vendor:publish --provider="Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider" --tag=config
- run
php artisan ide-helper:model -M
- run
php artisan ide-helper:generate
- here everything works fine, command+click (or windows+click) points to where in _ide_helper.php
- run
php artisan ide-helper:eloquent
- here i go
Non-static method 'where' should not be called statically, but the class has the '__magic' method.
and command+click points to where invendor/laravel/framework/src/Illuminate/Database/Query/Builder.php
Ok I see, I think I initially missed the you use ide-helper:eloquent
. IMHO that's quite a bastard comment and should be avoided, as it modifies your vendor files 😢
However, cloning your project I still don't know where I should get this
Non-static method 'where' should not be called statically, but the class has the '__magic' method
I can confirm the CDM-click gives 2 options to me now:
But this is expected in this setup I would say 🤷♀️
Trying to avoid writing the meta data of the models to them brings all this weird issues it seems to me.
I'm also getting this issue when using --write-mixin. Is there a solution?
I get this issue aswell. Have it on all my Eloquent models when calling create or so: