-
-
Notifications
You must be signed in to change notification settings - Fork 394
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
Internal error when a model has a legacy factory via legacy factories package and a regular factory #1810
Comments
The issue here likely stems from the fact that the laravel/legacy-factories package overrides the Edit: I missed that the new factory is now |
Ah, I found the issue---Larastan does not actually take into account the
|
Versions
Larastan Version: 2.8.0
Laravel Version: 10.39.0
PHP Version: 8.2.13
Legacy Factories Version: 1.3.2
--level
used: 8Repository: https://github.com/jamiewood678/larastan-legacy-factories-exception
Pull request with failing analyse: Recreated Internal Error jamiewood678/larastan-legacy-factories-exception#1
Other Notes
Description
When Laravel code calls the
factory
static function provided by theIlluminate\Database\Eloquent\Factories\HasFactory
trait on a model an internal error is thrown.This circumstance only happens when a model has both a legacy factory and a new factory. This can arise when legacy codebases that started on older versions of Laravel as the
laravel/legacy-factories
were introduced to help migrate codebases that referenced deprecated factories in a large volume of locations.Steps to reproduce
The PR/repository provided above contains a code base that can be used to create the issue
Here are the code steps to reproduce the bug. Assuming you already have a codebase installed with Laravel + Larastan
laravel/legacy-factories
Illuminate\Database\Eloquent\Factories\HasFactory
trait to the modelnewFactory
which returns the newly created regular factoryfactory
on the model in another PHP file which will be analysed by phpstanLaravel code where the issue was found
Internal Error Thrown
The text was updated successfully, but these errors were encountered: