Configurable

TypedPropertyFromAssignsRector

Add typed property from assigned types

 final class SomeClass
 {
-    private $name;
+    private string|null $name = null;

     public function run()
     {
         $this->name = 'string';
     }
 }

Configure your rector.php:

<?php

use Rector\Config\RectorConfig;
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector;

return RectorConfig::configure()
    ->withConfiguredRule(TypedPropertyFromAssignsRector::class, [
        'inline_public' => false,
    ]);