[Bug]: Adding query() triggers warning of Incompatible return type
Bug description
In a Laravel model, when running an Eloquent query, if I add the function query(), I get the warning of incompatible type suggesting that the return type should be the Laravel idea helper file.
Plugin version
11.3.0.252
Operating system
MacOS
Steps to reproduce
Removing the query() from the function eliminates the warning
Relevant log output
Hello. What is module()? Scope? Could you provide the model code?
Yes, module() is a scope.
Here I attach a simpler example with the code of the scope
With the #[Scope] approach I need to add query() or I'll get an error "Non-static method App\Models\Center::installed() cannot be called statically"
The same warning happens if I use the older scope prefix
Hello. Reproduced. It appeared in the last PhpStorm update. We will try to fix.
Fixed in 11.4. It should disappear after helper code generation with 11.4
I'm on the Laravel Idea plugin version 11.4.1.252, I've executed the "Generate helper code" function, but I still get the same warning if I set Illuminate\Support\Collection as the return value
Could you try to run main menu -> FIle > Invalidate Caches... and after that generate helper code again. I got the warning once, but after that, the helper code works ok. Seems, we have a floating bug here... And seems, It's not inside Laravel Idea. It asks PhpStorm about the type of some methods and get dfferent results...
I've invalidaded caches and generated code again, but the same warning keeps appearing 😭
We are sorry about this. We are going to fully rewrite the helper code generation part in 12.0, and probably will fix this there.