DateFormatPropertyToDateFormatAttributeRector

Changes model dateFormat property to use the DateFormat attribute

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

+#[DateFormat('U')]
 class User extends Model
 {
-    protected $dateFormat = 'U';
 }

Configure your rector.php:

<?php

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

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