Find the best Rector rule to solve your problem. Searching through 671 rules.

Found 3 rules:

FactoryApplyingStatesRector

Call the state methods directly instead of specify the name of state.

-$factory->state('delinquent');
-$factory->states('premium', 'delinquent');
+$factory->delinquent();
+$factory->premium()->delinquent();

FactoryDefinitionRector

Upgrade legacy factories to support classes.

 use Faker\Generator as Faker;

-$factory->define(App\User::class, function (Faker $faker) {
-    return [
-        'name' => $faker->name,
-        'email' => $faker->unique()->safeEmail,
-    ];
-});
+class UserFactory extends \Illuminate\Database\Eloquent\Factories\Factory
+{
+    protected $model = App\User::class;
+    public function definition()
+    {
+        return [
+            'name' => $this->faker->name,
+            'email' => $this->faker->unique()->safeEmail,
+        ];
+    }
+}

FactoryFuncCallToStaticCallRector

Use the static factory method instead of global factory function.

-factory(User::class);
+User::factory();