TablePropertyToTableAttributeRector

Changes model table-related properties to use the Table attribute

 use Illuminate\Database\Eloquent\Model;
+use Illuminate\Database\Eloquent\Attributes\Table;

+#[Table(table: 'users', key: 'user_id', keyType: 'string', incrementing: false)]
 class User extends Model
 {
-    protected $table = 'users';
-
-    protected $primaryKey = 'user_id';
-
-    protected $keyType = 'string';
-
-    protected $incrementing = false;
 }

Configure your rector.php:

<?php

use RectorLaravel\Rector\Class_\TablePropertyToTableAttributeRector;
use Rector\Config\RectorConfig;

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