ReplaceFakerInstanceWithHelperRector

Replace $this->faker with the fake() helper function in Factories

 class UserFactory extends Factory
 {
     public function definition()
     {
         return [
-            'name' => $this->faker->name,
-            'email' => $this->faker->unique()->safeEmail,
+            'name' => fake()->name,
+            'email' => fake()->unique()->safeEmail,
         ];
     }
 }

Configure your rector.php:

<?php

use RectorLaravel\Rector\PropertyFetch\ReplaceFakerInstanceWithHelperRector;
use Rector\Config\RectorConfig;

return RectorConfig::configure()
    ->withRules([
        ReplaceFakerInstanceWithHelperRector::class,
    ]);