Automated refactoring of deprecated properties using Rector
2.0If your codebase uses Faker properties (which are deprecated), you can automate the migration to their equivalent methods using Rector.
- Install Rector:
composer require --dev rector/rector- Run the migration process (replace
src/with your actual source directory):
vendor/bin/rector process src/ --config vendor/fakerphp/faker/rector-migrate.phpAlternatively, you can import the Faker migration configuration directly into your existing rector.php file:
<?php
declare(strict_types=1);
use Rector\Config;
return static function (Config\RectorConfig $rectorConfig): void {
$rectorConfig->import('vendor/fakerphp/faker/rector-migrate.php');
};