-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
factory method not recognized when using ide-helper:models -M #1589
Comments
@lk77 Could you let me know if you tried to define your factory implementation? like the following : /** @use HasFactory<YourModelFactory> */
use HasFactory; note: don't forget to replace |
I tried that solution, and it does not work, and it seems it's the same with all static methods like query(), they do not work with the -M option i guess there is some sort of "precedence" calculation between ide-helper annotations, and laravel annotations, or type inference of some sort edit : i removed all annotations from laravel manually in vendor, just to test, and now i can't ctrl+click anymore, but it still does not find the annotations in _ide_helper_models.php |
@khaled-sadek I'm having the same problem and the suggested fix didn't work. I tried the comment hint with the full path to the factory class and just the class alone (e.g. I just refactored to use mixins and really prefer it, but this makes writing tests incredibly annoying. Might switch back if there's not fix for this. Thanks! |
i have something like that : /**
* @method static \Database\Factories\User\UserFactory factory($count = null, $state = [])
*
* @mixin IdeHelperUser
*/
class User extends Authenticatable |
Versions:
Question:
When i'm using ide-helper:models -M,
the HasFactory::factory() method is not recognized properly,
it works fine without the -M,
somehow, using a mixin cause this line :
to not be recognized by phpstorm, which cause "polymorphic calls" warnings, because phpstorm expect a generic Factory instance, and not the real factory for the model,
do you have any idea why that is ?
thanks.
The text was updated successfully, but these errors were encountered: