TouchesPropertyToTouchesAttributeRector

Changes model touches property to use the touches attribute

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

+#[Touches(['posts'])]
 class User extends Model
 {
-    protected $touches = [
-        'posts',
-    ];
 }

Configure your rector.php:

<?php

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

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