PropertyHookRector

Replace getter/setter with property hook

 final class Product
 {
-    private string $name;
-
-    public function getName(): string
+    public string $name
     {
-        return $this->name;
-    }
-
-    public function setName(string $name): void
-    {
-        $this->name = ucfirst($name);
+        get => $this->name;
+        set($value) => $this->name = ucfirst($value);
     }
 }

Configure your rector.php:

<?php

use Rector\Config\RectorConfig;
use Rector\Php84\Rector\Class_\PropertyHookRector;

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