-
Notifications
You must be signed in to change notification settings - Fork 88
Open
Description
After enabling the new LARAVEL_FACTORIES set, I had to revert 120 changed models in a project where the HasFactory trait was added when no factory class actually exists. I would argue that in its current state, AddHasFactoryToModelsRector doesn't belong in this set as it's not reasonable to assume every app has a factory for every single model in their application.
Ideally, the rector would check if the factory exists first prior to adding the HasFactory trait. It would be nice if it added the appropriate @use docblock referencing the factory class as well. I don't know if this is currently feasible, though.
Just my two cents. Skipping that rule is an easy enough solution as well.
calebdw, GeniJaho and chrispmcgee
Metadata
Metadata
Assignees
Labels
No labels