ReadOnlyPropertyRector

Decorate read-only property with readonly attribute

 class SomeClass
 {
     public function __construct(
-        private string $name
+        private readonly string $name
     ) {
     }

     public function getName()
     {
         return $this->name;
     }
 }

Configure your rector.php:

<?php

use Rector\Config\RectorConfig;
use Rector\Php81\Rector\Property\ReadOnlyPropertyRector;

return RectorConfig::configure()
    ->withRules([
        ReadOnlyPropertyRector::class,
    ]);
SETS:  PHP 8.1